summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-08-12 10:53:50 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-13 15:48:26 +0200
commitc9eaa46c738ad23bbb3d6f3dfbdaf8a485d0a030 (patch)
tree7accb10dab27a0d532e801862b375a6b12aae5f6
parenta3c969cd92a2f658d322bec1cfe07c520b678bf7 (diff)
downloadgitlab-ce-c9eaa46c738ad23bbb3d6f3dfbdaf8a485d0a030.tar.gz
Labels need to be valid on name
-rw-r--r--app/models/label.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index e2379bb6d77..941520b4c74 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -9,7 +9,10 @@ class Label < ActiveRecord::Base
validates :project, presence: true
# Don't 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") }