From c9eaa46c738ad23bbb3d6f3dfbdaf8a485d0a030 Mon Sep 17 00:00:00 2001 From: Robert Schilling <rschilling@student.tugraz.at> Date: Tue, 12 Aug 2014 10:53:50 +0200 Subject: [PATCH] Labels need to be valid on name --- app/models/label.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/label.rb b/app/models/label.rb index e2379bb6d77e7..941520b4c7484 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") } -- GitLab