Sunday, 24 January 2010

Ruby on Rails: StartTLS

Using this feature in ActionMailer (for gmail, for example) requires ruby 1.8.7. If using any earlier, you will get an error similar to

Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. 14sm4080666ewy.11)

in your logs

Monday, 18 January 2010

Note to Self

If you want a rails model to accept nested attributes, it's really important to have
accepts_nested_attributes_for 
in your model definition.
Otherwise you get the rather cryptic error:
ActiveRecord::AssociationTypeMismatch in YourController#create    
YourDependentModel(#-615375688) expected, got Array(#-605176048)

Tuesday, 5 January 2010

Ruby Object Model

Dave Thomas's Lecture at Scotland on Rails 2009

  • Classes in Ruby are simply objects which hold tables of methods
  • IF it can't find a method call, it jumps to the parent
  • IF it gets to the top & doesn't find a method call, it goes back to the bottom & looks for a method called methodmissing
  • "Singleton Class" - a class any object has as soon as you add a method to it, it's invisible