app/controllers/tasks_controller.rb in bookyt_projects-0.2.1 vs app/controllers/tasks_controller.rb in bookyt_projects-0.2.2
- old
+ new
@@ -1,10 +1,14 @@
class TasksController < AuthorizedController
-
def new
- @task = Task.new(:project_id => params[:project_id]) if params[:project_id]
+ # Allow callers specifying defaults
+ @task = Task.new(params[:task])
+
+ # Nested resources support
+ @task.project_id ||= params[:project_id] if params[:project_id]
+
+ # Educated guessing of defaults
@task.person = current_user.person if current_user
new!{ projects_url(@task.project) }
end
-
-end
\ No newline at end of file
+end