Navigation Menu

Skip to content

Commit

Permalink
Rewrite TasksController#current_company_task_new in TaskTemplatesCont…
Browse files Browse the repository at this point in the history
…roller to create instance of Template instead of a task. Now TaskTemplatesController#new and TaskTemplatesController#update(inherited from TaskController) will use TaskTemplatesController#current_company_task_new instead of TasksController#current_company_task_new. This is example of design pattern "Template method".
  • Loading branch information
Anatoliy Lysenko committed Mar 8, 2010
1 parent b0ac754 commit 8270765
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/controllers/task_templates_controller.rb
Expand Up @@ -30,4 +30,10 @@ def update_tasks
def update_work_log
raise Exception, CUSTOM_ERROR_MESSAGE
end
protected
def current_company_task_new
task=Template.new
task.company=current_user.company
return task
end
end
2 changes: 1 addition & 1 deletion app/controllers/tasks_controller.rb
Expand Up @@ -778,7 +778,7 @@ def update_work_log
render :text => updated.to_s
end

private
protected
###
# Sets up the attributes needed to display new action
###
Expand Down

0 comments on commit 8270765

Please sign in to comment.