Module: Switchman::ActiveRecord::StatementCache::ClassMethods

Defined in:
lib/switchman/active_record/statement_cache.rb

Instance Method Summary collapse

Instance Method Details

#create(connection) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/switchman/active_record/statement_cache.rb', line 7

def create(connection)
  relation = yield ::ActiveRecord::StatementCache::Params.new

  _query_builder, binds = connection.cacheable_query(self, relation.arel)
  bind_map = ::ActiveRecord::StatementCache::BindMap.new(binds)
  new(relation.arel, bind_map, relation.klass)
end