Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Changeset [2161b8745a22379356b466a60b9aa763c0593f9b] by Mislav Marohnić

Revision 2161b8745a22379356b466a60b9aa763c0593f9b, committed by Mislav Marohnić · April 16th, 2010 @ 09:12 PM

improve how ActiveRecord::Observer defines callbacks on observed models

Instead of using a single notify_observers call for every callback type,
each observer now registers a unique callback for itself. Example:

before_save :_notify_user_observer_for_before_save

def _notify_user_observer_for_before_save

observer.update(:before_save, self)

end

Benefit: "before" callbacks halt when observer.update returns false.
This way, ActiveRecord observers can prevent records from saving.

[#4087 state:committed]

Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/2161b8745a22379356b466a60b9aa7...

2 changed files

  • M activerecord/CHANGELOG
  • M activerecord/lib/active_record/observer.rb