diff options
-rw-r--r-- | activerecord/lib/active_record/statement_cache.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index 1a2ff23013..d2a0c6f618 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -76,15 +76,13 @@ module ActiveRecord def initialize(block = Proc.new) @mutex = Mutex.new - @relation = nil @binds = nil - @block = block @query_builder = nil - @params = Params.new + @relation = block.call Params.new end def execute(params) - rel = relation @params + rel = @relation arel = rel.arel klass = rel.klass @@ -108,9 +106,5 @@ module ActiveRecord @query_builder ||= connection.cacheable_query(arel) } end - - def relation(values) - @relation || @mutex.synchronize { @relation ||= @block.call(values) } - end end end |