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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-20 06:17:04 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:24 +0300
commit9463551ece6c12574559a4768943ab90db7f617b (patch)
treea4fc438116b4cac6180df8ff8d8d974ad5d4d0c2 /app/models/label.rb
parentbdb7bf4b5188ffd68e54cbf671ba9ce1a4ffb1d1 (diff)
Validates uniqueness of title unless label is a template
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index f43bebbf71b..be0c20479d5 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -26,10 +26,8 @@ class Label < ActiveRecord::Base
validates :project, presence: true, if: :project_label?
# Don't allow ',' for label titles
- validates :title,
- presence: true,
- format: { with: /\A[^,]+\z/ },
- uniqueness: { scope: :project_id }
+ validates :title, presence: true, format: { with: /\A[^,]+\z/ }
+ validates :title, uniqueness: true, unless: :template?
before_save :nullify_priority