From d6eece764bb08b5309c1c469b81677b1eca8c23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Hendricksen?= Date: Thu, 31 Jul 2014 21:06:29 -0700 Subject: [PATCH] [Finishes #76105930] --- Gemfile | 2 ++ Gemfile.lock | 2 ++ app/controllers/songs_controller.rb | 2 +- app/views/songs/index.html.erb | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7bb56b8..25d9b30 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,8 @@ gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' +gem 'will_paginate' + group :development do gem 'spring' gem 'grb' diff --git a/Gemfile.lock b/Gemfile.lock index 7475957..ed40c28 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -170,6 +170,7 @@ GEM uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) + will_paginate (3.0.7) xpath (2.0.0) nokogiri (~> 1.3) @@ -190,3 +191,4 @@ DEPENDENCIES thin turbolinks uglifier (>= 1.3.0) + will_paginate diff --git a/app/controllers/songs_controller.rb b/app/controllers/songs_controller.rb index a8d64e1..3718e11 100644 --- a/app/controllers/songs_controller.rb +++ b/app/controllers/songs_controller.rb @@ -4,7 +4,7 @@ class SongsController < ApplicationController # GET /songs # GET /songs.json def index - @songs = Song.all + @songs = Song.paginate(page: params[:page], per_page: 10) end # GET /songs/1 diff --git a/app/views/songs/index.html.erb b/app/views/songs/index.html.erb index abcd3a0..295a940 100644 --- a/app/views/songs/index.html.erb +++ b/app/views/songs/index.html.erb @@ -32,6 +32,8 @@ +<%= will_paginate @songs %> +
<%= link_to 'New Song', new_song_path %>