module ActiveRecordShards::DefaultReplicaPatches::TypeCasterConnectionConnectionPatch

Public Instance Methods

connection() click to toggle source
Calls superclass method
# File lib/active_record_shards/default_replica_patches.rb, line 256
def connection
  return super if Thread.current[:_active_record_shards_in_migration]
  return super if Thread.current[:_active_record_shards_in_tx]

  if @klass.on_replica_by_default?
    @klass.on_replica.connection
  else
    super
  end
end