paginate blog

This commit is contained in:
jomo
2014-09-22 06:02:30 +02:00
parent ec3daa2882
commit 635bfe7a5e
2 changed files with 2 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ class BlogpostsController < ApplicationController
before_filter :auth, except: [:index, :show] before_filter :auth, except: [:index, :show]
def index def index
@posts = Blogpost.order("created_at desc") @posts = Blogpost.order("created_at desc").page(params[:page]).per(10)
end end
def show def show

View File

@@ -21,4 +21,5 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<%= paginate @posts %>
</div> </div>