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

15 lines
525 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
class IssueAssignee < ApplicationRecord
2017-08-17 22:00:37 +05:30
belongs_to :issue
2020-07-28 23:09:34 +05:30
belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :issue_assignees
2020-03-09 13:42:32 +05:30
validates :assignee, uniqueness: { scope: :issue_id }
2020-07-28 23:09:34 +05:30
scope :in_projects, ->(project_ids) { joins(:issue).where("issues.project_id in (?)", project_ids) }
scope :on_issues, ->(issue_ids) { where(issue_id: issue_ids) }
2021-01-03 14:25:43 +05:30
scope :for_assignee, ->(user) { where(assignee: user) }
2017-08-17 22:00:37 +05:30
end
2019-12-04 20:38:33 +05:30
IssueAssignee.prepend_if_ee('EE::IssueAssignee')