Module: Switchman::ActiveRecord::StatementCache::ClassMethods
- Defined in:
- lib/switchman/active_record/statement_cache.rb
Instance Method Summary collapse
Instance Method Details
#create(connection, block = Proc.new) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/switchman/active_record/statement_cache.rb', line 5 def create(connection, block = Proc.new) relation = block.call ::ActiveRecord::StatementCache::Params.new binds = ::Rails.version >= '5' ? relation.bound_attributes : relation.bind_values bind_map = ::ActiveRecord::StatementCache::BindMap.new(binds) new relation.arel, bind_map end |