diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2012-04-29 21:50:48 -0400 |
---|---|---|
committer | Marc-Andre Lafortune <github@marc-andre.ca> | 2012-04-29 21:51:50 -0400 |
commit | bad44e4f8f690039bd0db92ac25f10af536c6e71 (patch) | |
tree | 5818243402efeaf48c43af6d691f169a9089c059 /activemodel/lib/active_model | |
parent | ad2c5ea2786817592014fae09934398173c1a7f9 (diff) | |
download | rails-bad44e4f8f690039bd0db92ac25f10af536c6e71.tar.gz rails-bad44e4f8f690039bd0db92ac25f10af536c6e71.tar.bz2 rails-bad44e4f8f690039bd0db92ac25f10af536c6e71.zip |
Fix Observer by acting on singleton class [#3505]
Also [issue #1034] [pull #6068]
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/observing.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index 35b1a1f0c7..e303425a7c 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -194,7 +194,7 @@ module ActiveModel def observe(*models) models.flatten! models.collect! { |model| model.respond_to?(:to_sym) ? model.to_s.camelize.constantize : model } - redefine_method(:observed_classes) { models } + singleton_class.redefine_method(:observed_classes) { models } end # Returns an array of Classes to observe. |