module Octoball::AssociationShardChecker

Public Instance Methods

has_and_belongs_to_many(association_id, scope = nil, **options, &extension) click to toggle source
Calls superclass method
# File lib/octoball/association_shard_check.rb, line 29
def has_and_belongs_to_many(association_id, scope = nil, **options, &extension)
  assign_octoball_check_opts(options)
  super
end
has_many(name, scope = nil, **options, &extension) click to toggle source
Calls superclass method
# File lib/octoball/association_shard_check.rb, line 24
def has_many(name, scope = nil, **options, &extension)
  assign_octoball_check_opts(options)
  super
end

Private Instance Methods

assign_octoball_check_opts(options) click to toggle source
# File lib/octoball/association_shard_check.rb, line 36
def assign_octoball_check_opts(options)
  options[:before_add] = [:association_shard_check, options[:before_add]].compact.flatten
  options[:before_remove] = [:association_shard_check, options[:before_remove]].compact.flatten
end