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:
parent
77478f21af
commit
5fa497abf5
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue