Module: Switchman::ActiveRecord::Associations::Association
- Defined in:
- lib/switchman/active_record/associations.rb
Instance Method Summary collapse
Instance Method Details
#build_record(*args) ⇒ Object
11 12 13 |
# File 'lib/switchman/active_record/associations.rb', line 11 def build_record(*args) shard.activate { super } end |
#load_target ⇒ Object
15 16 17 |
# File 'lib/switchman/active_record/associations.rb', line 15 def load_target shard.activate { super } end |
#scope ⇒ Object
19 20 21 22 |
# File 'lib/switchman/active_record/associations.rb', line 19 def scope shard_value = @reflection.[:multishard] ? @owner : shard @owner.shard.activate { super.shard(shard_value, :association) } end |
#shard ⇒ Object
7 8 9 |
# File 'lib/switchman/active_record/associations.rb', line 7 def shard reflection.shard(owner) end |