Module: ActiveRecordShards::DefaultReplicaPatches::AssociationsAssociationFindTargetPatch

Defined in:
lib/active_record_shards/default_replica_patches.rb

Instance Method Summary collapse

Instance Method Details

#find_targetObject



173
174
175
176
177
178
179
# File 'lib/active_record_shards/default_replica_patches.rb', line 173

def find_target
  if klass
    on_replica_unless_tx { super }
  else
    super
  end
end

#on_replica_unless_txObject



181
182
183
# File 'lib/active_record_shards/default_replica_patches.rb', line 181

def on_replica_unless_tx
  klass.on_replica_unless_tx { yield }
end