From 545c4fa6c91eb283f430ebc7ba0b2ebadc873491 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 31 Aug 2011 13:12:34 +0000 Subject: [PATCH] Rails3: replace deprecated 'validate' method at CustomField model. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6912 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/custom_field.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index b8cea995e..8135378a5 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -25,6 +25,8 @@ class CustomField < ActiveRecord::Base validates_length_of :name, :maximum => 30 validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats + validate :validate_values + def initialize(attributes = nil) super self.possible_values ||= [] @@ -36,7 +38,7 @@ class CustomField < ActiveRecord::Base true end - def validate + def validate_values if self.field_format == "list" errors.add(:possible_values, :blank) if self.possible_values.nil? || self.possible_values.empty? errors.add(:possible_values, :invalid) unless self.possible_values.is_a? Array -- 2.39.5