Skip to content

Commit

Permalink
Add pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Gehani committed Sep 20, 2013
1 parent d9a9b42 commit 6a62878
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ gem 'simple_form', '~> 3.0.0.rc'
gem "paperclip", "~> 3.0"
gem 'aws-sdk'
gem 'faker'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate'

group :production do
gem 'pg'
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ GEM
bcrypt-ruby (3.1.2)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
bootstrap-will_paginate (0.0.10)
will_paginate
builder (3.1.4)
climate_control (0.0.3)
activesupport (>= 3.0)
Expand Down Expand Up @@ -142,13 +144,15 @@ GEM
uuidtools (2.1.4)
warden (1.2.3)
rack (>= 1.0)
will_paginate (3.0.3)

PLATFORMS
ruby

DEPENDENCIES
aws-sdk
bootstrap-sass (~> 2.3.2.2)
bootstrap-will_paginate
coffee-rails (~> 4.0.0)
devise
faker
Expand All @@ -165,3 +169,4 @@ DEPENDENCIES
sqlite3
turbolinks (= 1.1.1)
uglifier (>= 1.3.0)
will_paginate (= 3.0.3)
3 changes: 2 additions & 1 deletion app/controllers/pins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class PinsController < ApplicationController
# GET /pins
# GET /pins.json
def index
@pins = Pin.order("created_at desc")
# With pagination from will_paginate gem
@pins = Pin.order("created_at desc").page(params[:page]).per_page(20)

respond_to do |format|
format.html # index.html.erb
Expand Down
1 change: 1 addition & 0 deletions app/views/pins/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
<%= render @pins %>
</div>

<%= will_paginate @pins %>

0 comments on commit 6a62878

Please sign in to comment.