From c0507bdfdfcae734aa1de78a5a3bc585f7a95254 Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 22 Sep 2014 06:16:54 +0200 Subject: [PATCH] paginate threads --- app/controllers/forums_controller.rb | 1 + app/views/forums/show.html.erb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 61cd0d9..21321fb 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -12,6 +12,7 @@ class ForumsController < ApplicationController # sticky goes first, then sort by last activity (new replies) [t.sticky ? 0 : 1, -(t.replies.last.try(:created_at) || t.created_at).to_i] end + @threads = Kaminari.paginate_array(@threads).page(params[:page]) end def edit diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 0b3a958..bd985cd 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -32,4 +32,5 @@ <% end %> + <%= paginate @threads %> \ No newline at end of file