blob: af55a5dec9199adaee7b83d80d460c976ea448f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# frozen_string_literal: true
class IssueLink < ApplicationRecord
include FromUnion
include IssuableLink
belongs_to :source, class_name: 'Issue'
belongs_to :target, class_name: 'Issue'
scope :for_source_issue, ->(issue) { where(source_id: issue.id) }
scope :for_target_issue, ->(issue) { where(target_id: issue.id) }
scope :for_issues, ->(source, target) do
where(source: source, target: target).or(where(source: target, target: source))
end
class << self
def issuable_type
:issue
end
end
end
IssueLink.prepend_mod_with('IssueLink')
|