diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-12 14:16:25 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-13 12:28:19 +0200 |
commit | 9284038dbef5153dac40eda14f1685a72efe1d1a (patch) | |
tree | 1b195e94518f115316da6f98195943dc8d22c2c0 /app/models/label.rb | |
parent | 53ead2e35c9195ae1f68bf5d7154e341636caf1b (diff) | |
download | gitlab-ce-9284038dbef5153dac40eda14f1685a72efe1d1a.tar.gz |
Add, delete labels via API
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 |