Permalink
Browse files

fix ivar names and add reader methods

  • Loading branch information...
1 parent f85e4bc commit 8de3c433ef21d325c9ab3072c75da4b3d9043d8d @tenderlove tenderlove committed Apr 11, 2014
Showing with 6 additions and 7 deletions.
  1. +6 −7 activerecord/lib/active_record/statement_cache.rb
@@ -74,27 +74,26 @@ def bind(values)
end
end
+ attr_reader :bind_map, :query_builder, :klass
+
def initialize(block = Proc.new)
relation = block.call Params.new
- @binds = BindMap.new relation.bind_values
+ @bind_map = BindMap.new relation.bind_values
@klass = relation.klass
- @query_builder = query_builder @klass.connection, relation.arel
+ @query_builder = make_query_builder @klass.connection, relation.arel
end
def execute(params)
- klass = @klass
- bind_map = @binds
bind_values = bind_map.bind params
- builder = @query_builder
- sql = builder.sql_for bind_values, klass.connection
+ sql = query_builder.sql_for bind_values, klass.connection
klass.find_by_sql sql, bind_values
end
alias :call :execute
private
- def query_builder(connection, arel)
+ def make_query_builder(connection, arel)
connection.cacheable_query(arel)
end
end

0 comments on commit 8de3c43

Please sign in to comment.