diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-07-14 15:50:41 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-07-14 15:50:41 +0000 |
commit | fd8df67ddbe9219678caed5255ea47eadd60e061 (patch) | |
tree | cc5f7f828e657ac94ef8aedb9c9f7e46342427b0 | |
parent | fba5b433770fd8b7cc0f0a44bb6894340a87536c (diff) | |
download | redmine-fd8df67ddbe9219678caed5255ea47eadd60e061.tar.gz redmine-fd8df67ddbe9219678caed5255ea47eadd60e061.zip |
Handle min_length and max_length nil values (#17446).
git-svn-id: http://svn.redmine.org/redmine/branches/2.4-stable@13328 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/custom_field.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 00f1831d5..dd7597596 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -352,8 +352,8 @@ class CustomField < ActiveRecord::Base errs = [] unless value.to_s == '' errs << ::I18n.t('activerecord.errors.messages.invalid') unless regexp.blank? or value =~ Regexp.new(regexp) - errs << ::I18n.t('activerecord.errors.messages.too_short', :count => min_length) if min_length > 0 and value.length < min_length - errs << ::I18n.t('activerecord.errors.messages.too_long', :count => max_length) if max_length > 0 and value.length > max_length + errs << ::I18n.t('activerecord.errors.messages.too_short', :count => min_length) if min_length && min_length > 0 && value.length < min_length + errs << ::I18n.t('activerecord.errors.messages.too_long', :count => max_length) if max_length && max_length > 0 && value.length > max_length # Format specific validations case field_format |