Browse files

Refactoring. Skinny TasksController, Fat WorkLog Model.

  • Loading branch information...
1 parent 047d4ee commit 0f5a0161728276c5d4024428cfe5b35c04edbd04 @lenochka lenochka committed Feb 26, 2011
Showing with 1 addition and 2 deletions.
  1. +0 −2 app/controllers/tasks_controller.rb
  2. +1 −0 app/models/work_log.rb
View
2 app/controllers/tasks_controller.rb
@@ -353,7 +353,6 @@ def hide_task(id, hide=1)
task.save
worklog = WorkLog.new
- worklog.user = current_user
worklog.for_task(task)
worklog.log_type = hide == 1 ? EventLog::TASK_ARCHIVED : EventLog::TASK_RESTORED
worklog.body = ""
@@ -474,7 +473,6 @@ def big_fat_controller_method
worklog.body << "\n"
worklog.body << params[:comment]
end
- worklog.user = current_user
worklog.for_task(@task)
worklog.access_level_id= (params[:work_log].nil? or params[:work_log][:access_level_id].nil?) ? 1 : params[:work_log][:access_level_id]
worklog.save!
View
1 app/models/work_log.rb
@@ -180,6 +180,7 @@ def notify(files=[])
end
def for_task(task)
+ self.user_id = task.updated_by_id if _user_.nil?
self.task=task
self.project=task.project
self.company= task.project.company

0 comments on commit 0f5a016

Please sign in to comment.