Module: ActiveRecord::ShardFor::Patch::ClassMethods
- Defined in:
- lib/activerecord/shard_for/patch.rb
Instance Method Summary collapse
-
#define_callbacks(*args) ⇒ Object
For ActiveSupport::Callbacks patch.
-
#enum(definitions) ⇒ Object
For ActiveRecord::Enum patch.
Instance Method Details
#define_callbacks(*args) ⇒ Object
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.
18 19 20 21 22 23 24 25 26 |
# 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) ⇒ Object
For ActiveRecord::Enum patch. See github.com/yuemori/activerecord-shard_for/issues/10
9 10 11 12 |
# File 'lib/activerecord/shard_for/patch.rb', line 9 def enum(definitions) super shard_repository.all.each { |shard| shard.defined_enums = defined_enums } end |