Module: ActionController::EventHelper

Defined in:
lib/rails_ext/action_controller/event_helper.rb

Instance Method Summary collapse

Instance Method Details

#trigger_event(object, change = nil, options = {}) ⇒ Object



11
12
13
14
# File 'lib/rails_ext/action_controller/event_helper.rb', line 11

def trigger_event(object, change = nil, options = {})
  type = :"#{object.class.name.underscore}_#{change}"
  Adva::Event.trigger type, object, self, options
end

#trigger_events(object, *changes) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/rails_ext/action_controller/event_helper.rb', line 3

def trigger_events(object, *changes)
  options = changes.extract_options!
  # changes += object.state_changes
  changes.uniq.each do |change|
    trigger_event(object, change, options)
  end
end