module Switchman::ActiveRecord::StatementCache::ClassMethods

Public Instance Methods

create(connection, &block) click to toggle source
# File lib/switchman/active_record/statement_cache.rb, line 7
def create(connection, &block)
  relation = block.call ::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