Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-08-12 16:16:25 +0400
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-13 14:28:19 +0400
commit9284038dbef5153dac40eda14f1685a72efe1d1a (patch)
tree1b195e94518f115316da6f98195943dc8d22c2c0 /app/models/label.rb
parent53ead2e35c9195ae1f68bf5d7154e341636caf1b (diff)
Add, delete labels via API
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb9
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