diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2016-12-20 21:52:09 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2016-12-22 02:53:24 +0300 |
commit | 805bbe889328bff55b49290294721405148cc980 (patch) | |
tree | 0beb7c9621db87d5f11928ca8231af8b1de21a6c /app/controllers/dashboard/todos_controller.rb | |
parent | 9b66aa6e04ab66af7ce11e26076ebf431ca938c5 (diff) |
adds specs for respective behaviour
Diffstat (limited to 'app/controllers/dashboard/todos_controller.rb')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index b2333a02392..40652129f4c 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -1,11 +1,12 @@ class Dashboard::TodosController < Dashboard::ApplicationController - include KaminariPagination - before_action :find_todos, only: [:index, :destroy_all] def index @sort = params[:sort] - @todos = bounded_pagination(@todos, params[:page]) + @todos = @todos.page(params[:page]) + if @todos.out_of_range? && @todos.total_pages != 0 + redirect_to dashboard_todos_path(page: @todos.total_pages) + end end def destroy |