diff --git a/app/models/label.rb b/app/models/label.rb index e2379bb6d77e709ebf4ea3d91cfe12d65b872772..941520b4c748418347a06cf240717f7bd8153d20 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") }