2016-09-29 09:46:39 +05:30
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
class << self
|
|
|
|
def count_for_collection(ids)
|
2017-09-10 17:25:29 +05:30
|
|
|
group(:issue_id)
|
|
|
|
.where(issue_id: ids)
|
|
|
|
.pluck('issue_id', 'COUNT(*) as count')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|