diff options
author | Myron Marston <myron.marston@gmail.com> | 2011-08-12 19:58:37 -0700 |
---|---|---|
committer | Myron Marston <myron.marston@gmail.com> | 2011-08-12 20:48:44 -0700 |
commit | d3c15a1d31d77e44b142c96cb55b654f3552a89d (patch) | |
tree | 6da096998bbd1c3a0764a10a3c933f943b6e973a /activemodel/lib/active_model | |
parent | 943a37348a9fdef73670be3d8452d436b7db0e69 (diff) | |
download | rails-d3c15a1d31d77e44b142c96cb55b654f3552a89d.tar.gz rails-d3c15a1d31d77e44b142c96cb55b654f3552a89d.tar.bz2 rails-d3c15a1d31d77e44b142c96cb55b654f3552a89d.zip |
Allow ActiveRecord observers to be disabled.
We have to use Observer#update rather than Observer#send since the enabled state is checked in #update before forwarding the method call on.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/observing.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index d48f2e8a1f..7a910d18e7 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -226,10 +226,10 @@ module ActiveModel # Send observed_method(object) if the method exists and # the observer is enabled for the given object's class. - def update(observed_method, object) #:nodoc: + def update(observed_method, object, &block) #:nodoc: return unless respond_to?(observed_method) return if disabled_for?(object) - send(observed_method, object) + send(observed_method, object, &block) end # Special method sent by the observed class when it is inherited. |