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

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

15 lines
489 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
class MergeRequestAssignee < ApplicationRecord
2020-11-24 15:15:51 +05:30
belongs_to :merge_request, touch: true
2020-07-28 23:09:34 +05:30
belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :merge_request_assignees
2020-03-13 15:44:24 +05:30
validates :assignee, uniqueness: { scope: :merge_request_id }
2020-07-28 23:09:34 +05:30
2021-06-08 01:23:25 +05:30
scope :in_projects, ->(project_ids) { joins(:merge_request).where(merge_requests: { target_project_id: project_ids }) }
2021-12-11 22:18:48 +05:30
def cache_key
2022-10-11 01:57:18 +05:30
[model_name.cache_key, id, assignee.cache_key]
2021-12-11 22:18:48 +05:30
end
2019-07-07 11:18:12 +05:30
end