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

Ruby 1.9: fix Relation respond_to? and method_missing

This commit is contained in:
Jeremy Kemper 2009-11-10 11:00:50 -08:00
parent 77478f21af
commit 5fa497abf5

View file

@ -110,19 +110,17 @@ module ActiveRecord
end
def respond_to?(method)
if @relation.respond_to?(method) || Array.instance_methods.include?(method.to_s)
true
else
super
end
@relation.respond_to?(method) || Array.method_defined?(method) || super
end
private
def method_missing(method, *args, &block)
if @relation.respond_to?(method)
@relation.send(method, *args, &block)
elsif Array.instance_methods.include?(method.to_s)
elsif Array.method_defined?(method)
to_a.send(method, *args, &block)
else
super
end
end
end