From 947514fbfc4b7ec9b97e67c31a532e8c237eac67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 19 Aug 2015 13:16:17 +0200 Subject: [PATCH] adds pagination to debates#index Ref: #80 --- app/controllers/debates_controller.rb | 2 +- app/views/debates/index.html.erb | 1 + spec/features/debates_spec.rb | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index 4f56b45ab..f0d5ed754 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -5,7 +5,7 @@ class DebatesController < ApplicationController respond_to :html, :js def index - @debates = Debate.includes(:tags).search(params) + @debates = Debate.includes(:tags).search(params).page(params[:page]) set_debate_votes(@debates) end diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 0e3e41d1d..92df365f0 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -75,6 +75,7 @@
<%= render @debates %> + <%= paginate @debates %>