Add length validations for string fields (#24283).

Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@15989 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-11-19 11:13:41 +00:00
parent e610fda877
commit 7b3f2b51c0
6 changed files with 7 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ class CustomField < ActiveRecord::Base
validates_presence_of :name, :field_format
validates_uniqueness_of :name, :scope => :type
validates_length_of :name, :maximum => 30
validates_length_of :regexp, maximum: 30
validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
validate :validate_custom_field
attr_protected :id