diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-14 16:12:07 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:27 -0200 |
commit | 297892011330ecdd2fa7cbe47fbc6fd4f3b62171 (patch) | |
tree | 6cbbb21eae4f3fa3d28b33599a0ea87fbf0f34ec /app/models/label.rb | |
parent | de9d3915d249a59e65226f6dd2ebe1f50a47306e (diff) | |
download | gitlab-ce-297892011330ecdd2fa7cbe47fbc6fd4f3b62171.tar.gz |
Add LabelPriority model
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 8b775e81db7..3ce4e253035 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -16,6 +16,7 @@ class Label < ActiveRecord::Base default_value_for :color, DEFAULT_COLOR has_many :lists, dependent: :destroy + has_many :priorities, class_name: 'LabelPriority' 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' @@ -26,8 +27,6 @@ class Label < ActiveRecord::Base validates :title, presence: true, format: { with: /\A[^,]+\z/ } validates :title, uniqueness: { scope: [:group_id, :project_id] } - before_save :nullify_priority - default_scope { order(title: :asc) } scope :templates, -> { where(template: true) } @@ -149,10 +148,6 @@ class Label < ActiveRecord::Base end end - def nullify_priority - self.priority = nil if priority.blank? - end - def sanitize_title(value) CGI.unescapeHTML(Sanitize.clean(value.to_s)) end |