Module: ActiveRecordShards::DefaultReplicaPatches::TypeCasterConnectionConnectionPatch
- Defined in:
- lib/active_record_shards/default_replica_patches.rb
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/active_record_shards/default_replica_patches.rb', line 199 def connection return super if Thread.current[:_active_record_shards_in_migration] return super if ActiveRecord::Base._in_transaction? if @klass.on_replica_by_default? @klass.on_replica.connection else super end end |