Sha256: 4d0b6323212059829c7182c2b7921e588e7be6e531e00500f6d10619fe1ef5e1

Contents?: true

Size: 562 Bytes

Versions: 4

Compression:

Stored size: 562 Bytes

Contents

module Approval
  module RespondForm
    class Reject < Base
      validate :ensure_user_cannot_respond_to_my_request

      private

        def prepare
          instrument "reject" do |payload|
            ::Approval::Request.transaction do
              request.lock!
              request.assign_attributes(state: :rejected, rejected_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/reject.rb
approval-0.7.0 app/models/approval/respond_form/reject.rb
approval-0.6.1 app/models/approval/respond_form/reject.rb
approval-0.6.0 app/models/approval/respond_form/reject.rb