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