Interesting Things
- Rails Observers: Observers need to be “primed” before they start working. Call
Observer.instance before you start testing your Observers. - Cookies in Rspec and Test::Unit: Cookie keys are not symbols, unlike many collection-like constructs in Rails; they are instead always Strings. Thus, use
"cookie_name" not :cookie_name - Rails reminder: ActiveRecord::create returns the stored object if successful, and the unsaved and invalid object in memory if the object could not be saved. If you want to know whether or not your save was successful, use ActiveRecord::save, which returns
true when successful and false otherwise. - And on a further note, a larger discussion should be had regarding when to use ActiveRecord::create, ActiveRecord::save, ActiveRecord::new, and ActiveRecord.dependent_object.build the latter of which is created when you have a
has_many relationship with another ActiveRecord.
Total Stand-up Meeting Time: 20:00 minutes