Module: Switchman::ActiveRecord::CollectionAssociation
- Defined in:
- lib/switchman/active_record/association.rb
Instance Method Summary collapse
Instance Method Details
#_create_record ⇒ Object
34 35 36 |
# File 'lib/switchman/active_record/association.rb', line 34 def _create_record(*) shard.activate { super } end |
#find_target ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/switchman/active_record/association.rb', line 25 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.connection_classes, owner.class.connection_classes].uniq) do super end end |