From 58c5261efa6ca0134ebfac8a701915d5e36d2c25 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Sun, 24 Aug 2014 04:42:12 -0700 Subject: Fixed find_by("sql fragment without bindings") on master * Also duplicated find_by tests from relations_test.rb to finder_test.rb now that we have a completely different implementation on the class (in core.rb with AST caching stuff). * Also removed a (failing) test that used mocks. Now that we have tests for the behavior, there's no point having another test that tests the implementation (that it delegates). Further, what the test was implying is nolonger true with the current implementation, because Class.find_by is a real method now. --- activerecord/lib/active_record/core.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index d22806fbdf..2cbb8442a1 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -151,7 +151,7 @@ module ActiveRecord end def find_by(*args) - return super if current_scope || args.length > 1 || reflect_on_all_aggregations.any? + return super if current_scope || !(Hash === args.first) || reflect_on_all_aggregations.any? hash = args.first -- cgit v1.2.3