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



109
110
111
112
113
114
115
# File 'lib/active_record_shards/default_replica_patches.rb', line 109

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



117
118
119
# File 'lib/active_record_shards/default_replica_patches.rb', line 117

def on_replica_unless_tx
  @klass.on_replica_unless_tx { yield }
end