Method: ActiveRecord::ConnectionAdapters::DatabaseStatements#cacheable_query

Defined in:
lib/active_record/connection_adapters/abstract/database_statements.rb

#cacheable_query(klass, arel) ⇒ Object

This is used in the StatementCache object. It returns an object that can be used to query the database repeatedly.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/active_record/connection_adapters/abstract/database_statements.rb', line 49

def cacheable_query(klass, arel) # :nodoc:
  if prepared_statements
    sql, binds = visitor.compile(arel.ast, collector)
    query = klass.query(sql)
  else
    collector = klass.partial_query_collector
    parts, binds = visitor.compile(arel.ast, collector)
    query = klass.partial_query(parts)
  end
  [query, binds]
end