diff options
author | Mislav Marohnić <mislav.marohnic@gmail.com> | 2010-04-16 19:37:12 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-16 13:12:53 -0700 |
commit | 2161b8745a22379356b466a60b9aa763c0593f9b (patch) | |
tree | cb5a3df164f14d85d9916b97d4d4de0c3b609b31 /railties/guides/source/performance_testing.textile | |
parent | c2ca73c9ee5fc3dadf69cf565bd5e2bb30c82c50 (diff) | |
download | rails-2161b8745a22379356b466a60b9aa763c0593f9b.tar.gz rails-2161b8745a22379356b466a60b9aa763c0593f9b.tar.bz2 rails-2161b8745a22379356b466a60b9aa763c0593f9b.zip |
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>
Diffstat (limited to 'railties/guides/source/performance_testing.textile')
0 files changed, 0 insertions, 0 deletions