summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-09 17:32:46 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-09 17:32:46 +0000
commit6768bec4560e3c9a31578e2879f345f4c9e77a17 (patch)
tree88a5794488f55efae223104bcbec645f747149ab /app/models/time_entry.rb
parentc0f44db4f705e45127cd2352cd86abdbfa0ec1d1 (diff)
downloadredmine-6768bec4560e3c9a31578e2879f345f4c9e77a17.tar.gz
redmine-6768bec4560e3c9a31578e2879f345f4c9e77a17.zip
Fixed: no error is raised when entering invalid hours on the issue update form (#2465).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2251 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 57a75604d..f10b179d1 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -32,7 +32,7 @@ class TimeEntry < ActiveRecord::Base
:description => :comments
validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
- validates_numericality_of :hours, :allow_nil => true
+ validates_numericality_of :hours, :allow_nil => true, :message => :activerecord_error_invalid
validates_length_of :comments, :maximum => 255, :allow_nil => true
def after_initialize
@@ -54,7 +54,7 @@ class TimeEntry < ActiveRecord::Base
end
def hours=(h)
- write_attribute :hours, (h.is_a?(String) ? h.to_hours : h)
+ write_attribute :hours, (h.is_a?(String) ? (h.to_hours || h) : h)
end
# tyear, tmonth, tweek assigned where setting spent_on attributes