diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-08-16 19:55:02 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-08-18 18:46:24 +0300 |
commit | 30654fc9c1afc222ebae5c5367657bd8f6e615b2 (patch) | |
tree | bcf07e2723405510a369071b6cf4ac4ee1be4895 /app/controllers/dashboard/todos_controller.rb | |
parent | 1f14495124e38a0682476744b95a8299ad06593a (diff) |
Simplify SQL queries of marking a todo as done
Diffstat (limited to 'app/controllers/dashboard/todos_controller.rb')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 1243bb96d4d..1f8cf1d91b0 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -6,6 +6,8 @@ class Dashboard::TodosController < Dashboard::ApplicationController end def destroy + todo = Todo.new(id: params[:id]) + TodoService.new.mark_todos_as_done([todo], current_user) respond_to do |format| @@ -27,10 +29,6 @@ class Dashboard::TodosController < Dashboard::ApplicationController private - def todo - @todo ||= find_todos.find(params[:id]) - end - def find_todos @todos ||= TodosFinder.new(current_user, params).execute end |