This project is archived and is in readonly mode.
Changeset [2161b8745a22379356b466a60b9aa763c0593f9b] 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...
Committed by Mislav Marohnić
- M activerecord/CHANGELOG
- M activerecord/lib/active_record/observer.rb
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>