summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-22 12:06:33 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-22 12:06:33 +0000
commite683bd75828ed6498bbec398897c4a2d1215abd0 (patch)
tree38e6e3609ce840c46c940f9b7188280a33ddc1c0 /app/models/time_entry.rb
parent34f2d382b75e1b094734e0f35db6224253951df6 (diff)
downloadredmine-e683bd75828ed6498bbec398897c4a2d1215abd0.tar.gz
redmine-e683bd75828ed6498bbec398897c4a2d1215abd0.zip
Rails3: model: replace deprecated 'validate' method at TimeEntry model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7448 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 60b5de1c3..9a03e4c8e 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -38,6 +38,7 @@ class TimeEntry < ActiveRecord::Base
validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
validates_numericality_of :hours, :allow_nil => true, :message => :invalid
validates_length_of :comments, :maximum => 255, :allow_nil => true
+ validate :validate_time_entry
named_scope :visible, lambda {|*args| {
:include => :project,
@@ -57,7 +58,7 @@ class TimeEntry < ActiveRecord::Base
self.project = issue.project if issue && project.nil?
end
- def validate
+ def validate_time_entry
errors.add :hours, :invalid if hours && (hours < 0 || hours >= 1000)
errors.add :project_id, :invalid if project.nil?
errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)