module ActiveRecord::ShardFor::Patch::ClassMethods

Public Instance Methods

define_callbacks(*args) click to toggle source

For ActiveSupport::Callbacks patch.

Since define_callbacks has not been successfully propagated to the shard class when called, we also call define_callback of the shard class.

Calls superclass method
# File lib/activerecord/shard_for/patch.rb, line 18
def define_callbacks(*args)
  if abstract_class
    all_shards.each do |model|
      model.define_callbacks(*args)
    end
  end

  super
end
enum(definitions) click to toggle source

For ActiveRecord::Enum patch. See github.com/yuemori/activerecord-shard_for/issues/10

Calls superclass method
# File lib/activerecord/shard_for/patch.rb, line 9
def enum(definitions)
  super
  shard_repository.all.each { |shard| shard.defined_enums = defined_enums }
end