aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/dynamic_matchers.rb
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-01-24 18:05:33 -0800
committerGodfrey Chan <godfreykfc@gmail.com>2014-01-29 10:53:48 -0800
commit9ed66648b59b160b43c83c349263e8cb97eaa088 (patch)
tree4a0f50070e1e68fef5c437b422afddc7cc5383fe /activerecord/lib/active_record/dynamic_matchers.rb
parent0f156100a2d25fba820016c684cbc3d3fadbc1bd (diff)
downloadrails-9ed66648b59b160b43c83c349263e8cb97eaa088.tar.gz
rails-9ed66648b59b160b43c83c349263e8cb97eaa088.tar.bz2
rails-9ed66648b59b160b43c83c349263e8cb97eaa088.zip
Fixed a bug in AR::Base#respond_to?
Before: >> ActiveRecord::Base.respond_to?(:find_by_something) NoMethodError: undefined method `abstract_class?' for Object:Class After: >> ActiveRecord::Base.respond_to?(:find_by_something) => false
Diffstat (limited to 'activerecord/lib/active_record/dynamic_matchers.rb')
-rw-r--r--activerecord/lib/active_record/dynamic_matchers.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb
index 5caab09038..e94b74063e 100644
--- a/activerecord/lib/active_record/dynamic_matchers.rb
+++ b/activerecord/lib/active_record/dynamic_matchers.rb
@@ -6,8 +6,12 @@ module ActiveRecord
# then we can remove the indirection.
def respond_to?(name, include_private = false)
- match = Method.match(self, name)
- match && match.valid? || super
+ if self == Base
+ super
+ else
+ match = Method.match(self, name)
+ match && match.valid? || super
+ end
end
private