1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ruby 1.9.2: explicitly raise NoMethodError for explicit coercion attempts. Calling super gives us NameErrors.

This commit is contained in:
Jeremy Kemper 2009-12-06 18:03:18 -08:00
parent adc2115132
commit 071af66e9e

View file

@ -45,7 +45,7 @@ class NilClass
def method_missing(method, *args, &block)
# Ruby 1.9.2: disallow explicit coercion via method_missing.
if method == :to_ary || method == :to_str
super
raise NoMethodError, "undefined method `#{method}' for nil:NilClass"
elsif klass = METHOD_CLASS_MAP[method]
raise_nil_warning_for klass, method, caller
else