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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s