0.0
No commit activity in last 3 years
No release in over 3 years
Super lightweight and simple Rails 3 pagination for when you don't need to count the number of items or pages. simple_pager shows Previous and More links.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

simple_pager

Super lightweight and simple Rails 3 pagination for when you don't need to count the number of items or pages.

Sometimes will_paginate is too much for your pagination needs. If you've got a complicated query and performance is more important than being able to navigate all the pages, then you'll want something simple like this. Or if you are joining tables and adding .uniq to your relation, will_paginate won't actually work, since it's count method is a little broken.

So simple_pager just shows Previous and More links. It's designed to play nicely with will_paginate so you can use both in the same app.

Uses markup compatible with Bootstrap's pager class.

Installation:

# add to Gemfile in Rails 3 app
gem 'simple_pager'

Basic simple_pager use

# perform a paginated query:
@posts = Post.pager(:page => params[:page])

# specify a different number of items per page:
@posts = Post.pager(:page => params[:page], :per_page => 15)

# render page links in the view:
<%= simple_pager @posts %>

# customise the page link names:
<%= simple_pager @posts,nil,'Newer','Older' %>

Remember to add some CSS styles.

You can customize the default "per_page" value:

# set a default per_page value for the Post model:
class Post
  self.per_page = 10
end