Sha256: e3a20b2e0d0cb1a3e80ca4c987f603a9cbce933933d8c0369afdd4746474607b

Contents?: true

Size: 564 Bytes

Versions: 4

Compression:

Stored size: 564 Bytes

Contents

module Approval
  module RespondForm
    class Approve < Base
      validate :ensure_user_cannot_respond_to_my_request

      private

        def prepare
          instrument "approve" do |payload|
            ::Approval::Request.transaction do
              request.lock!
              request.assign_attributes(state: :approved, approved_at: Time.current, respond_user_id: user.id)
              payload[:comment] = request.comments.new(user_id: user.id, content: reason)
              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/respond_form/approve.rb
approval-0.7.0 app/models/approval/respond_form/approve.rb
approval-0.6.1 app/models/approval/respond_form/approve.rb
approval-0.6.0 app/models/approval/respond_form/approve.rb