Permalink
Browse files

Ruby 1.9.2: exclude to_str from explicit coercion check too

  • Loading branch information...
1 parent 64082b3 commit b9f352316e9a80cb81c3e3358f46cebf01b51783 @jeremy jeremy committed Dec 7, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/attribute_methods.rb
@@ -230,8 +230,8 @@ def evaluate_attribute_method(attr_name, method_definition, method_name=attr_nam
# 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
- raise NoMethodError, "undefined method `to_ary' for #{inspect}:#{self.class}"
+ 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

0 comments on commit b9f3523

Please sign in to comment.