debian-mirror-gitlab/app/models/approval.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
359 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
class Approval < ApplicationRecord
2021-02-22 17:27:13 +05:30
include CreatedAtFilterable
2022-08-27 11:52:29 +05:30
include Importable
2021-02-22 17:27:13 +05:30
2020-07-28 23:09:34 +05:30
belongs_to :user
belongs_to :merge_request
2022-08-27 11:52:29 +05:30
validates :merge_request_id, presence: true, unless: :importing?
2020-07-28 23:09:34 +05:30
validates :user_id, presence: true, uniqueness: { scope: [:merge_request_id] }
scope :with_user, -> { joins(:user) }
end