Module: Switchman::ActiveRecord::CollectionAssociation
- Defined in:
- lib/switchman/active_record/association.rb
Instance Method Summary collapse
Instance Method Details
#find_target ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/switchman/active_record/association.rb', line 35 def find_target shards = reflection.[:multishard] && owner.respond_to?(:associated_shards) ? owner.associated_shards : [shard] # activate both the owner and the target's shard category, so that Reflection#join_id_for, # when called for the owner, will be returned relative to shard the query will execute on Shard.with_each_shard(shards, [klass.shard_category, owner.class.shard_category].uniq) do super end end |