Class: Todoro::TasksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Todoro::TasksController
- Defined in:
- app/controllers/todoro/tasks_controller.rb
Instance Method Summary collapse
Instance Method Details
#complete ⇒ Object
34 35 36 37 |
# File 'app/controllers/todoro/tasks_controller.rb', line 34 def complete @task.update(status: "completed") redirect_to task_list_path(taskable: @task_list.taskable.class.name, taskable_id: @task_list.taskable.id, id: @task_list.id), notice: "Task marked as completed." end |
#create ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/todoro/tasks_controller.rb', line 10 def create @task = @task_list.tasks.new(task_params) if @task.save redirect_to task_list_path(taskable: @task_list.taskable.class.name, taskable_id: @task_list.taskable.id, id: @task_list.id), notice: "Task created successfully." else render :new end end |
#destroy ⇒ Object
29 30 31 32 |
# File 'app/controllers/todoro/tasks_controller.rb', line 29 def destroy @task.destroy redirect_to @task_list, notice: "Task deleted." end |
#edit ⇒ Object
19 |
# File 'app/controllers/todoro/tasks_controller.rb', line 19 def edit; end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/todoro/tasks_controller.rb', line 6 def new @task = @task_list.tasks.new end |
#update ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/todoro/tasks_controller.rb', line 21 def update if @task.update(task_params) redirect_to @task_list, notice: "Task updated successfully." else render :edit end end |