Sha256: 568a095b83a2432eb3238f776d7df58d9456dca193335ca64e4e06fafc19a042

Contents?: true

Size: 600 Bytes

Versions: 8

Compression:

Stored size: 600 Bytes

Contents

module Reactor
  module ResourceActionable
    class UpdateEvent < ActionEvent
      perform do
        if actionable_resource.valid?
          action_event "#{resource_name}_updated",
                       target: actionable_resource,
                       changes: actionable_resource.previous_changes.as_json
        else
          action_event "#{resource_name}_update_failed",
                       target: actionable_resource,
                       errors: actionable_resource.errors.as_json,
                       attributes: params[resource_name]
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reactor-0.19.0 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.18.0 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.17.0 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.16.1 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.16.0 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.15.1 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.15.0 lib/reactor/controllers/concerns/actions/update_event.rb
reactor-0.14.0 lib/reactor/controllers/concerns/actions/update_event.rb