Rails3: model: replace deprecated 'validate' method at Issue model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7429 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-21 06:12:35 +00:00
parent ca9c6bc254
commit 97c7e84f49
1 changed files with 2 additions and 1 deletions

View File

@ -58,6 +58,7 @@ class Issue < ActiveRecord::Base
validates_length_of :subject, :maximum => 255 validates_length_of :subject, :maximum => 255
validates_inclusion_of :done_ratio, :in => 0..100 validates_inclusion_of :done_ratio, :in => 0..100
validates_numericality_of :estimated_hours, :allow_nil => true validates_numericality_of :estimated_hours, :allow_nil => true
validate :validate_issue
named_scope :visible, lambda {|*args| { :include => :project, named_scope :visible, lambda {|*args| { :include => :project,
:conditions => Issue.visible_condition(args.shift || User.current, *args) } } :conditions => Issue.visible_condition(args.shift || User.current, *args) } }
@ -337,7 +338,7 @@ class Issue < ActiveRecord::Base
Setting.issue_done_ratio == 'issue_field' Setting.issue_done_ratio == 'issue_field'
end end
def validate def validate_issue
if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty? if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty?
errors.add :due_date, :not_a_date errors.add :due_date, :not_a_date
end end