BigW Consortium Gitlab

merge_requests_closing_issues.rb 391 Bytes
Newer Older
1 2 3
class MergeRequestsClosingIssues < ActiveRecord::Base
  belongs_to :merge_request
  belongs_to :issue
4

5 6
  validates :merge_request_id, uniqueness: { scope: :issue_id }, presence: true
  validates :issue_id, presence: true
7 8 9

  class << self
    def count_for_collection(ids)
10 11 12
      group(:issue_id)
        .where(issue_id: ids)
        .pluck('issue_id', 'COUNT(*) as count')
13 14
    end
  end
15
end