Skip to content
Browse files

eagerly build the relation object

  • Loading branch information...
1 parent 90c9a09 commit 47037b648d1b56470dba35798fc5e30f1143eb95 @tenderlove tenderlove committed Apr 10, 2014
Showing with 2 additions and 8 deletions.
  1. +2 −8 activerecord/lib/active_record/statement_cache.rb
View
10 activerecord/lib/active_record/statement_cache.rb
@@ -76,15 +76,13 @@ def bind(values)
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 @@ def query_builder(connection, arel)
@query_builder ||= connection.cacheable_query(arel)
}
end
-
- def relation(values)
- @relation || @mutex.synchronize { @relation ||= @block.call(values) }
- end
end
end

0 comments on commit 47037b6

Please sign in to comment.
Something went wrong with that request. Please try again.