7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/switchman/active_record/statement_cache.rb', line 7
def create(connection, &block)
relation = block.call ::ActiveRecord::StatementCache::Params.new
if ::Rails.version >= "5.2"
query_builder, binds = connection.cacheable_query(self, relation.arel)
bind_map = ::ActiveRecord::StatementCache::BindMap.new(binds)
new(relation.arel, bind_map, relation.klass)
else
bind_map = ::ActiveRecord::StatementCache::BindMap.new(relation.bound_attributes)
new relation.arel, bind_map
end
end
|