Sha256: 1326403eab73e9c396de8b47dae0961ec30b860fc5d5717c6278662e00313954

Contents?: true

Size: 473 Bytes

Versions: 4

Compression:

Stored size: 473 Bytes

Contents

module Approval
  module RespondForm
    class Reject < Base
      validate :ensure_user_cannot_respond_to_my_request

      private

        def prepare
          ::Approval::Request.transaction do
            request.lock!
            request.assign_attributes(state: :rejected, rejected_at: Time.current, respond_user_id: user.id)
            request.comments.new(user_id: user.id, content: reason)
            yield(request)
          end
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
approval-0.5.0 app/models/approval/respond_form/reject.rb
approval-0.4.0 app/models/approval/respond_form/reject.rb
approval-0.3.7 app/models/approval/respond_form/reject.rb
approval-0.3.5 lib/approval/models/approval/respond_form/reject.rb