diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-06 18:22:09 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-06 18:22:09 -0800 |
commit | 63e435955e16cf976a8382e757529f4597549f2e (patch) | |
tree | d131874edd4d98ef97afccac26f5d96cec3b02f2 /activemodel | |
parent | 071af66e9ede4057bf1d3e3d248b3949d74bc9c5 (diff) | |
download | rails-63e435955e16cf976a8382e757529f4597549f2e.tar.gz rails-63e435955e16cf976a8382e757529f4597549f2e.tar.bz2 rails-63e435955e16cf976a8382e757529f4597549f2e.zip |
Ruby 1.9.2: explicitly raise NoMethodError for explicit coercion attempts
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 977a101277..8f855958c6 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -235,6 +235,10 @@ module ActiveModel # It's also possible to instantiate related objects, so a Client class belonging to the clients # table with a +master_id+ foreign key can instantiate master through Client#master. def method_missing(method_id, *args, &block) + if method_id == :to_ary || method_id == :to_str + raise NoMethodError, "undefined method `#{method_id}' for #{inspect}:#{self.class}" + end + method_name = method_id.to_s if match = match_attribute_method?(method_name) guard_private_attribute_method!(method_name, args) |