Module: Octoball::ShardedCollectionProxyCreate
- Included in:
- Octoball
- Defined in:
- lib/octoball/association.rb
Instance Method Summary collapse
Instance Method Details
#create(klass, association) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/octoball/association.rb', line 30 def create(klass, association) shard = association.owner.current_shard return super unless shard return RelationProxy.new(super, shard) if shard == ActiveRecord::Base.current_shard ret = nil ActiveRecord::Base.connected_to(shard: shard, role: Octoball.current_role) do ret = RelationProxy.new(super, shard) nil # return nil to avoid loading relation end ret end |