module Octopus::AssociationShardTracking
Public Class Methods
extended(base)
click to toggle source
# File lib/octopus/association_shard_tracking.rb, line 21 def self.extended(base) base.send(:include, InstanceMethods) end
Public Instance Methods
assign_octopus_opts(scope, options)
click to toggle source
# File lib/octopus/association_shard_tracking.rb, line 57 def assign_octopus_opts(scope, options) if options == {} && scope.is_a?(Hash) default_octopus_opts(scope) else default_octopus_opts(options) end end
default_octopus_opts(options)
click to toggle source
# File lib/octopus/association_shard_tracking.rb, line 52 def default_octopus_opts(options) options[:before_add] = [ :connection_on_association=, options[:before_add] ].compact.flatten options[:before_remove] = [ :connection_on_association=, options[:before_remove] ].compact.flatten end
has_and_belongs_to_many(association_id, scope = nil, options = {}, &extension)
click to toggle source
Calls superclass method
# File lib/octopus/association_shard_tracking.rb, line 47 def has_and_belongs_to_many(association_id, scope = nil, options = {}, &extension) assign_octopus_opts(scope, options) super end
has_many(association_id, scope = nil, options = {}, &extension)
click to toggle source
Calls superclass method
# File lib/octopus/association_shard_tracking.rb, line 38 def has_many(association_id, scope = nil, options = {}, &extension) if options == {} && scope.is_a?(Hash) default_octopus_opts(scope) else default_octopus_opts(options) end super end