Plugins - Will Paginate

StarAdd to favorites

WillPaginate

Pagination is just limiting the number of records displayed. Why should you let it get in your way while developing, then? This plugin makes magic happen. Did you ever want to be able to do just this on a model:

  Post.paginate :page => 1, :order => 'created_at DESC'

… and then render the page links with a single view helper? Well, now you can.

Some resources to get you started:

Example usage

Use a paginate finder in the controller:

    @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC'

Yeah, paginate works just like find — it just doesn’t fetch all the records. Don’t forget to tell it which page you want, or it will complain! Read more on WillPaginate::Finder::ClassMethods.

Render the posts in your view like you would normally do. When you need to render pagination, just stick this in:

    <%= will_paginate @posts %>

You’re done.

Mislav Marohnić

http://github.com/mislav/will_paginate/tree/master

git://github.com/mislav/will_paginate.git

Rails' (MIT)

  • Currently 4.4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment
Artem Vasiliev 29 Feb 2008

RSS feed on will_paginate source repository commits: http://codenotifier.com/projects/10.rss

Sven Fuchs 7 Jan 2008

You can use willpaginate within Liquid templates with the willpaginateliquidized plugin: http://agilewebdevelopment.com/plugins/willpaginate_liquidized

p-daddy 6 Jul 2007

great plugin. great documentation--clarity and wit! who could ask for more?

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.
Recruiting software

Have a comment?