Module: Switchman::ActiveRecord::BelongsToAssociation
- Defined in:
- lib/switchman/active_record/association.rb
Instance Method Summary collapse
Instance Method Details
#replace_keys(record, force: false) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/switchman/active_record/association.rb', line 40 def replace_keys(record, force: false) if record&.class&.sharded_column?(reflection.association_primary_key(record.class)) foreign_id = record[reflection.association_primary_key(record.class)] owner[reflection.foreign_key] = Shard.relative_id_for(foreign_id, record.shard, owner.shard) else super end end |