diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-12 10:53:50 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-13 15:48:26 +0200 |
commit | c9eaa46c738ad23bbb3d6f3dfbdaf8a485d0a030 (patch) | |
tree | 7accb10dab27a0d532e801862b375a6b12aae5f6 | |
parent | a3c969cd92a2f658d322bec1cfe07c520b678bf7 (diff) | |
download | gitlab-ce-c9eaa46c738ad23bbb3d6f3dfbdaf8a485d0a030.tar.gz |
Labels need to be valid on name
-rw-r--r-- | app/models/label.rb | 5 |
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") } |