diff options
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 4b77e0e01a..1b7f579aa3 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -135,7 +135,7 @@ module ActiveRecord key = primary_key s = find_by_statement_cache[key] || find_by_statement_cache.synchronize { - find_by_statement_cache[key] ||= StatementCache.new { |params| + find_by_statement_cache[key] ||= StatementCache.create { |params| where(key => params[key]).limit(1) } } @@ -159,7 +159,7 @@ module ActiveRecord klass = self s = find_by_statement_cache[key] || find_by_statement_cache.synchronize { - find_by_statement_cache[key] ||= StatementCache.new { |params| + find_by_statement_cache[key] ||= StatementCache.create { |params| wheres = key.each_with_object({}) { |param,o| o[param] = params[param] } |