Class: ActiveRecord::StatementCache::PartialQuery
- Defined in:
- lib/active_record/statement_cache.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(values) ⇒ PartialQuery
constructor
A new instance of PartialQuery.
- #sql_for(binds, connection) ⇒ Object
Constructor Details
#initialize(values) ⇒ PartialQuery
Returns a new instance of PartialQuery.
41 42 43 44 45 46 |
# File 'lib/active_record/statement_cache.rb', line 41 def initialize values @values = values @indexes = values.each_with_index.find_all { |thing,i| Arel::Nodes::BindParam === thing }.map(&:last) end |
Instance Method Details
#sql_for(binds, connection) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/active_record/statement_cache.rb', line 48 def sql_for(binds, connection) val = @values.dup binds = binds.dup @indexes.each { |i| val[i] = connection.quote(*binds.shift.reverse) } val.join end |