From 6768bec4560e3c9a31578e2879f345f4c9e77a17 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 9 Jan 2009 17:32:46 +0000 Subject: 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 --- app/models/time_entry.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') 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 -- cgit v1.2.3