method

prohibit_shard_swapping

rails latest stable - Class: ActiveRecord::ConnectionHandling
prohibit_shard_swapping(enabled = true)
public

Prohibit swapping shards while inside of the passed block.

In some cases you may want to be able to swap shards but not allow a nested call to connected_to or connected_to_many to swap again. This is useful in cases you’re using sharding to provide per-request database isolation.