summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-26 17:12:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-26 17:12:11 +0000
commitd6daeca40ad2aa180ac807875861b987b11ba3eb (patch)
treeb250a606ef4128bdbff8bf500ca123168c12a835 /app/models/time_entry.rb
parentb3e5f1a1c39822923160e376e99c05d370429cfd (diff)
downloadredmine-d6daeca40ad2aa180ac807875861b987b11ba3eb.tar.gz
redmine-d6daeca40ad2aa180ac807875861b987b11ba3eb.zip
Fixed: IssueController#edit doesn't set default Activity as default (#1302).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1461 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index ddaff2b60..4bd2d33b8 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -29,6 +29,12 @@ class TimeEntry < ActiveRecord::Base
validates_numericality_of :hours, :allow_nil => true
validates_length_of :comments, :maximum => 255
+ def after_initialize
+ if new_record?
+ self.activity ||= Enumeration.default('ACTI')
+ end
+ end
+
def before_validation
self.project = issue.project if issue && project.nil?
end