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

18 lines
422 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
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