diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-10 11:00:50 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-10 11:00:50 -0800 |
commit | 5fa497abf5b885187130e58aefcb1c3228295e3c (patch) | |
tree | af6f9294da78a4d7e60cb73535c86c39a1275a7b /activerecord/lib/active_record | |
parent | 77478f21af980c8879762fc65def8cacba5a7eb7 (diff) | |
download | rails-5fa497abf5b885187130e58aefcb1c3228295e3c.tar.gz rails-5fa497abf5b885187130e58aefcb1c3228295e3c.tar.bz2 rails-5fa497abf5b885187130e58aefcb1c3228295e3c.zip |
Ruby 1.9: fix Relation respond_to? and method_missing
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 6bc56ecf15..5f0eec754f 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -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 |