Sha256: 7082290949f34fe70ea2cb9d8b8d6712081640a127304395603a8545086a75b8

Contents?: true

Size: 530 Bytes

Versions: 5

Compression:

Stored size: 530 Bytes

Contents

module ActionController
  module EventHelper
    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
    
    def trigger_event(object, change = nil, options = {})
      type = :"#{object.class.name.underscore}_#{change}"
      Adva::Event.trigger type, object, self, options
    end
  end
end

ActionController::Base.send :include, ActionController::EventHelper

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adva-0.2.4 lib/rails_ext/action_controller/event_helper.rb
adva-0.2.3 lib/rails_ext/action_controller/event_helper.rb
adva-0.2.2 lib/rails_ext/action_controller/event_helper.rb
adva-0.2.1 lib/rails_ext/action_controller/event_helper.rb
adva-0.2.0 lib/rails_ext/action_controller/event_helper.rb