Module: Tengine::Event::ModelNotifiable

Defined in:
lib/tengine/event/model_notifiable.rb

Overview

activemodelなどのObserverの仕組みを使ってイベントキューにモデルの 登録、変更、削除を通知するための実装を提供するモジュールです。

guides.rubyonrails.org/active_record_validations_callbacks.html#observers mongoid.org/docs/callbacks/observers.html

Instance Method Summary collapse

Instance Method Details

#after_create(record) ⇒ Object



10
11
12
# File 'lib/tengine/event/model_notifiable.rb', line 10

def after_create(record)
  fire_event(:created, record)
end

#after_destroy(record) ⇒ Object



18
19
20
# File 'lib/tengine/event/model_notifiable.rb', line 18

def after_destroy(record)
  fire_event(:destroyed, record)
end

#after_update(record) ⇒ Object



14
15
16
# File 'lib/tengine/event/model_notifiable.rb', line 14

def after_update(record)
  fire_event(:updated, record)
end