Module: ActiveRecordShards::DefaultReplicaPatches::ActiveRelationPatches

Defined in:
lib/active_record_shards/default_replica_patches.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/active_record_shards/default_replica_patches.rb', line 93

def self.included(base)
  [:calculate, :exists?, :pluck, :load].each do |m|
    ActiveRecordShards::DefaultReplicaPatches.wrap_method_in_on_replica(false, base, m)
  end

  ActiveRecordShards::DefaultReplicaPatches.wrap_method_in_on_replica(false, base, :to_sql, force_on_replica: true)
end

Instance Method Details

#on_replica_unless_txObject



101
102
103
# File 'lib/active_record_shards/default_replica_patches.rb', line 101

def on_replica_unless_tx
  @klass.on_replica_unless_tx { yield }
end