diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2012-04-29 00:51:56 -0400 |
---|---|---|
committer | Marc-Andre Lafortune <github@marc-andre.ca> | 2012-04-29 00:51:56 -0400 |
commit | 569fb1fffb216ad96721fe1f5d706535e9920154 (patch) | |
tree | e7145e60e436a92059be03263676292af0bc8aac /activemodel/lib | |
parent | 85c056cc1f82ebbf795cdd70b9068ab50513e5d5 (diff) | |
download | rails-569fb1fffb216ad96721fe1f5d706535e9920154.tar.gz rails-569fb1fffb216ad96721fe1f5d706535e9920154.tar.bz2 rails-569fb1fffb216ad96721fe1f5d706535e9920154.zip |
Generate appropriate error more judiciously
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/observing.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index 5aa27f00da..cc60c9ac72 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -90,8 +90,9 @@ module ActiveModel def instantiate_observer(observer) #:nodoc: # string/symbol if observer.respond_to?(:to_sym) - observer.to_s.camelize.constantize.instance - elsif observer.respond_to?(:instance) + observer = observer.to_s.camelize.constantize + end + if observer.respond_to?(:instance) observer.instance else raise ArgumentError, |