Method: FayeRails::Controller.observe

Defined in:
lib/faye-rails/controller.rb

.observe(model_klass, action = :after_create, &block) ⇒ Object

Observe a model for any of the ActiveRecord::Callbacks as of v3.2.6 they are: before_validation after_validation before_save before_create after_create after_save after_commit api.rubyonrails.org/classes/ActiveRecord/Callbacks.html action defaults to after_create


21
22
23
24
# File 'lib/faye-rails/controller.rb', line 21

def self.observe(model_klass, action = :after_create, &block)
  # Dynamically create a new observe class
  ObserverFactory.define(model_klass, action, &block)
end