Skip to content
This repository
Browse code

Revert "Ruby 1.9.2: explicitly raise NoMethodError for attempts at ex…

…plicit coercion"

This reverts commit 64082b3.

This change broke compatibility with 1.8.6 and was only needed for older 1.9.2 versions

Conflicts:

	activerecord/lib/active_record/attribute_methods.rb
  • Loading branch information...
commit b154b97ea47701dc39b9583fe8247b18990c5fda 1 parent 15cafbe
Michael Koziarski authored August 11, 2010
4  activerecord/lib/active_record/attribute_methods.rb
@@ -230,10 +230,6 @@ def evaluate_attribute_method(attr_name, method_definition, method_name=attr_nam
230 230
     # It's also possible to instantiate related objects, so a Client class belonging to the clients
231 231
     # table with a +master_id+ foreign key can instantiate master through Client#master.
232 232
     def method_missing(method_id, *args, &block)
233  
-      if method_id == :to_ary || method_id == :to_str
234  
-        raise NoMethodError, "undefined method `#{method_id}' for #{inspect}:#{self.class}"
235  
-      end
236  
-
237 233
       method_name = method_id.to_s
238 234
 
239 235
       if self.class.private_method_defined?(method_name)
2  activesupport/lib/active_support/whiny_nil.rb
@@ -45,7 +45,7 @@ def id
45 45
     def method_missing(method, *args, &block)
46 46
       # Ruby 1.9.2: disallow explicit coercion via method_missing.
47 47
       if method == :to_ary || method == :to_str
48  
-        raise NoMethodError, "undefined method `#{method}' for nil:NilClass"
  48
+        super
49 49
       elsif klass = METHOD_CLASS_MAP[method]
50 50
         raise_nil_warning_for klass, method, caller
51 51
       else

0 notes on commit b154b97

Please sign in to comment.
Something went wrong with that request. Please try again.