From ae81a2f76da3bfc54a9313c140b6ca10d718870a Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 22 Sep 2014 06:05:07 +0200 Subject: [PATCH] paginate info --- app/controllers/info_controller.rb | 2 +- app/views/info/index.html.erb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/info_controller.rb b/app/controllers/info_controller.rb index a1c9892..4018c38 100644 --- a/app/controllers/info_controller.rb +++ b/app/controllers/info_controller.rb @@ -4,7 +4,7 @@ class InfoController < ApplicationController before_filter :auth, except: [:index, :show] def index - @info = Info.all.sort_by{|i| i.title} + @info = Info.order(:title).page(params[:page]) end def show diff --git a/app/views/info/index.html.erb b/app/views/info/index.html.erb index e1738d2..7660f1d 100644 --- a/app/views/info/index.html.erb +++ b/app/views/info/index.html.erb @@ -8,4 +8,5 @@ <% @info.each do |info| %> <%= link_to info.title, info %> <% end %> + <%= paginate @info %> \ No newline at end of file