Fixed: time entries created with the default activity even if a different one is specified (#1302).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1533 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
40a9bbe946
commit
846045fd05
2 files changed
+7
-3
No files matched your search
@@ -30,8 +30,10 @@ class TimeEntry < ActiveRecord::Base
|
||||
validates_length_of :comments, :maximum => 255
|
||||
|
||||
def after_initialize
|
||||
if new_record?
|
||||
self.activity ||= Enumeration.default('ACTI')
|
||||
if new_record? && self.activity.nil?
|
||||
if default_activity = Enumeration.default('ACTI')
|
||||
self.activity_id = default_activity.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user