Merged r6298 from trunk (#8865).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@7768 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-11-11 11:37:55 +00:00
parent 83a2283b7d
commit f22ff1f1c2
2 changed files with 19 additions and 2 deletions
+8
View File
@@ -42,6 +42,14 @@ class CustomField < ActiveRecord::Base
errors.add(:possible_values, :invalid) unless self.possible_values.is_a? Array
end
if regexp.present?
begin
Regexp.new(regexp)
rescue
errors.add(:regexp, :invalid)
end
end
# validate default value
v = CustomValue.new(:custom_field => self.clone, :value => default_value, :customized => nil)
v.custom_field.is_required = false