Sha256: 63f0e9e4459e398467dc7a5bcb6ca34177e4b10578a3244afdbe3ad543d407b3

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 Bytes

Contents

module Approval
  module RequestForm
    class Create < Base
      private

        def prepare
          instrument "request" do |payload|
            ::Approval::Request.transaction do
              payload[:comment] = request.comments.new(user_id: user.id, content: reason)
              Array(records).each do |record|
                request.items.new(
                  event: "create",
                  resource_type: record.class.to_s,
                  params: record.create_params_for_approval,
                )
              end
              yield(request)
            end
          end
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
approval-0.7.1 app/models/approval/request_form/create.rb
approval-0.7.0 app/models/approval/request_form/create.rb
approval-0.6.1 app/models/approval/request_form/create.rb
approval-0.6.0 app/models/approval/request_form/create.rb