]> source.dussan.org Git - redmine.git/commitdiff
Rails3: replace deprecated 'validate' method at CustomField model.
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 31 Aug 2011 13:12:34 +0000 (13:12 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 31 Aug 2011 13:12:34 +0000 (13:12 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6912 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/custom_field.rb

index b8cea995e9ef5cd731edfd41a771a755cd6f7b0f..8135378a5769cf665c2c88839f15df0ac967c49a 100644 (file)
@@ -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