Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

eagerly build the relation object

  • Loading branch information...
commit 47037b648d1b56470dba35798fc5e30f1143eb95 1 parent 90c9a09
@tenderlove tenderlove authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.