Sha256: 129fe112c4360462ec2d1b8ac1b491bc99df048acd4532023932866093fd4179

Contents?: true

Size: 461 Bytes

Versions: 5

Compression:

Stored size: 461 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: user)
            request.comments.new(user: user, content: reason)
            yield(request)
          end
        end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
approval-0.3.4 lib/approval/models/approval/respond_form/reject.rb
approval-0.3.3 lib/approval/models/approval/respond_form/reject.rb
approval-0.3.2 lib/approval/models/approval/respond_form/reject.rb
approval-0.3.1 lib/approval/models/approval/respond_form/reject.rb
approval-0.3.0 lib/approval/models/approval/respond_form/reject.rb