Adding pagination

Pagination was one of the easiest things to add.  I installed the will_paginate and bootstrap_will_paginate gems.

I edited my Pins controller:

.
.
.
  def index
    @pins = Pin.order("created_at desc").page(params[:page]).per_page(20)
.
.
.

At the bottom of app/views/pins/index.html.erb I added:

<%= will_paginate @pins %>

And now I have good looking pagination!

Screen Shot 2013-04-07 at 9.55.45 PM

 

Advertisements