blob: 7f7c114803dd55154a33ba209a406b504702a4be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class MergeRequestsClosingIssues < ActiveRecord::Base
belongs_to :merge_request
belongs_to :issue
validates :merge_request_id, uniqueness: { scope: :issue_id }, presence: true
validates :issue_id, presence: true
class << self
def count_for_collection(ids)
group(:issue_id)
.where(issue_id: ids)
.pluck('issue_id', 'COUNT(*) as count')
end
end
end
|