module Octopus::AssociationShardTracking::InstanceMethods
Public Instance Methods
connection_on_association=(record)
click to toggle source
# File lib/octopus/association_shard_tracking.rb, line 49 def connection_on_association=(record) return unless ::Octopus.enabled? return if !self.class.connection.respond_to?(:current_shard) || !self.respond_to?(:current_shard) if !record.current_shard.nil? && !current_shard.nil? && record.current_shard != current_shard fail 'Association Error: Records are from different shards' end record.current_shard = self.class.connection.current_shard = current_shard if should_set_current_shard? end