Module: WireUpModels::ClassMethods

Defined in:
lib/active_model_listener.rb

Instance Method Summary collapse

Instance Method Details

#inherited(child) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/active_model_listener.rb', line 11

def inherited(child)
  super

  child.after_create do |record|
    ActiveModelListener.dispatch record, :create
  end

  child.after_update do |record|
    ActiveModelListener.dispatch record, :update
  end

  child.after_destroy do |record|
    ActiveModelListener.dispatch record, :destroy
  end
end