123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::StatementCache::PartialQuery

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Query
Instance Chain:
self, Query
Inherits: ActiveRecord::StatementCache::Query
Defined in: activerecord/lib/active_record/statement_cache.rb

Class Method Summary

Query - Inherited

Instance Method Summary

Constructor Details

.new(values) ⇒ PartialQuery

[ GitHub ]

  
# File 'activerecord/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)

[ GitHub ]

  
# File 'activerecord/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