Module: Kantox::Split::Hooker
- Defined in:
- lib/kantox/split/hooker.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- ACTIONS =
[:create, :update, :destroy]
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/kantox/split/hooker.rb', line 8 def self.included base fail TypeError.new("Hooker may be included in «ActiveRecord::Base»d classes since it requires «after_commit» hook") unless base <= ::ActiveRecord::Base base.include Kantox::Split::Utils base.include InstanceMethods base.extend ClassMethods ACTIONS.each do |action| base.after_commit "hooked_action_on_#{action}", on: action end end |