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.
44 45 46 47 48 49 |
# File 'lib/active_record/statement_cache.rb', line 44 def initialize(values) @values = values @indexes = values.each_with_index.find_all { |thing, i| Substitute === thing }.map(&:last) end |
Instance Method Details
#sql_for(binds, connection) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/active_record/statement_cache.rb', line 51 def sql_for(binds, connection) val = @values.dup @indexes.each do |i| value = binds.shift if ActiveModel::Attribute === value value = value.value_for_database end val[i] = connection.quote(value) end val.join end |