summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-14 18:04:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-14 18:04:16 +0000
commit88d847a1d51249236a57a2a5ddf2019e448b42c2 (patch)
treefc5993331669700f22877d310d517a60a466d678 /app/models/time_entry.rb
parent7a35682cd9aca946ad37efc5e902d47f60536929 (diff)
downloadredmine-88d847a1d51249236a57a2a5ddf2019e448b42c2.tar.gz
redmine-88d847a1d51249236a57a2a5ddf2019e448b42c2.zip
Fixes TimeEntry#spent_on= so that datetimes don't get stored in SQLite3 (#7258).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4708 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index b832277da..ade802868 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -66,6 +66,9 @@ class TimeEntry < ActiveRecord::Base
# these attributes make time aggregations easier
def spent_on=(date)
super
+ if spent_on.is_a?(Time)
+ self.spent_on = spent_on.to_date
+ end
self.tyear = spent_on ? spent_on.year : nil
self.tmonth = spent_on ? spent_on.month : nil
self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil