diff options
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index ce982579675..b8dc11a5245 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -7,13 +7,14 @@ class Label < ActiveRecord::Base validates :project, presence: true # Dont allow '?', '&', and ',' for label titles - validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ } + validates :title, + presence: true, + format: { with: /\A[^&\?,&]*\z/ }, + uniqueness: true scope :order_by_name, -> { reorder("labels.title ASC") } - def name - title - end + alias_attribute :name, :title def open_issues_count issues.opened.count |