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

app/models/custom_value.rb

index 6c6848321465ee4f2de5603755996b2af6aaa1bb..6d4af178a1bb73fe629625f4ea39a572ee7e5d99 100644 (file)
@@ -19,6 +19,8 @@ class CustomValue < ActiveRecord::Base
   belongs_to :custom_field
   belongs_to :customized, :polymorphic => true
 
+  validate :validate_custom_value
+
   def after_initialize
     if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?))
       self.value ||= custom_field.default_value
@@ -47,7 +49,7 @@ class CustomValue < ActiveRecord::Base
   end
 
 protected
-  def validate
+  def validate_custom_value
     if value.blank?
       errors.add(:value, :blank) if custom_field.is_required? and value.blank?
     else