summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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") }