Add association to merge requests

This commit is contained in:
Alfredo Sumaran 2016-03-01 21:04:13 -05:00
parent 6aa50165b0
commit 3992e2269b
1 changed files with 1 additions and 0 deletions

View File

@ -27,6 +27,7 @@ class Label < ActiveRecord::Base
belongs_to :project
has_many :label_links, dependent: :destroy
has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
has_many :merge_requests, through: :label_links, source: :target, source_type: 'MergeRequest'
validates :color, color: true, allow_blank: false
validates :project, presence: true, unless: Proc.new { |service| service.template? }