Sha256: 962b2a827447decca301e4f09ddf241396da68e17139e33b0b8360a37e8b55a9

Contents?: true

Size: 576 Bytes

Versions: 8

Compression:

Stored size: 576 Bytes

Contents

module Reactor
  module ResourceActionable
    class CreateEvent < ActionEvent
      perform do
        if actionable_resource.valid?
          action_event "#{resource_name}_created",
                       target: actionable_resource,
                       attributes: params[resource_name]
        else
          action_event "#{resource_name}_create_failed",
                       errors: actionable_resource.errors.as_json,
                       attributes: params[resource_name],
                       target: nested_resource
        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/create_event.rb
reactor-0.18.0 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.17.0 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.16.1 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.16.0 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.15.1 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.15.0 lib/reactor/controllers/concerns/actions/create_event.rb
reactor-0.14.0 lib/reactor/controllers/concerns/actions/create_event.rb