Labels need to be valid on name

This commit is contained in:
Robert Schilling 2014-08-12 10:53:50 +02:00
parent a3c969cd92
commit c9eaa46c73
1 changed files with 4 additions and 1 deletions

View File

@ -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") }