Skip to content

Commit

Permalink
Merge pull request #26 from morganp/clean_pagination
Browse files Browse the repository at this point in the history
Article Pagination using kaminari
  • Loading branch information
Jordan Byron authored and Jordan Byron committed Jun 27, 2011
2 parents 66ff352 + c3b784f commit 9b834a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -9,6 +9,7 @@ gem "omniauth", '~> 0.2.5'
gem "pg"
gem "rdiscount"
gem "rest-client", '~> 1.6.3'
gem "kaminari", '~> 0.12.4'

group :test do
gem "capybara"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -68,6 +68,8 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
json_pure (1.5.3)
kaminari (0.12.4)
rails (>= 3.0.0)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
Expand Down Expand Up @@ -178,6 +180,7 @@ DEPENDENCIES
factory_girl_rails
haml-rails
jquery-rails
kaminari (~> 0.12.4)
mocha
omniauth (~> 0.2.5)
pg
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/articles_controller.rb
Expand Up @@ -3,7 +3,7 @@ class ArticlesController < ApplicationController
before_filter :find_article, :authorized_users_only, :only => [:edit, :update, :destroy]

def index
@articles = Article.includes(:author).order("id desc")
@articles = Article.includes(:author).order("id desc").page(params[:page])
end

def new
Expand Down
1 change: 1 addition & 0 deletions app/views/articles/index.html.haml
@@ -1,3 +1,4 @@
= paginate @articles
%ul
- @articles.each do |article|
= content_tag_for :li, article do
Expand Down

0 comments on commit 9b834a1

Please sign in to comment.