Skip to content

Commit

Permalink
Will Paginate docs and contributors
Browse files Browse the repository at this point in the history
git-svn-id: svn://errtheblog.com/svn/plugins/will_paginate@389 1eaa51fe-a21a-0410-9c2e-ae7a00a434c4
  • Loading branch information
mislav committed Sep 27, 2007
1 parent 406c611 commit c7ec4a5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
37 changes: 22 additions & 15 deletions README
@@ -1,15 +1,15 @@
= WillPaginate

Quick quiz: Where does pagination logic belong?
Pagination is just limiting the number of records displayed. Why should you let
it get in your way while doing more important tasks on your project? This
plugin makes magic happen. Ever wanted to be able to do just this:

a) in the model;
b) in the controller;
c) in views;
d) all of the above.
Post.paginate :page => 1

We think you know the answer (if you think hard enough).
... and then render the page links with a single call to a view helper? Well,
now you can. Simply:

This plugin makes magic happen. You *will* paginate!
script/plugin install svn://errtheblog.com/svn/plugins/will_paginate


== Example usage:
Expand All @@ -18,15 +18,16 @@ Use a paginate finder in the controller:

@posts = Post.paginate_by_board_id @board.id, :page => params[:page]

Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the records.
Just don't forget to tell it which page you want!
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. (Copy and paste the example fancy CSS styles from the bottom.)
You're done. (Copy and paste the example fancy CSS styles from the bottom.) You can find the option list at WillPaginate::ViewHelpers.

How does it know how much items to fetch per page? It asks your model by calling
+Post.per_page+. You can define it like this:
Expand Down Expand Up @@ -63,15 +64,21 @@ resultset, but WillPaginate view helpers also need that object to be able to ren
<%= will_paginate @posts %>


== Authors, credits
== Authors, credits, contact!

REPORT BUGS on Lighthouse: http://err.lighthouseapp.com/projects/466-plugins/overview

BROWSE SOURCE on Warehouse: http://plugins.require.errtheblog.com/browser/will_paginate

Want to discuss, request features, ask questions? Join the Google group:
http://groups.google.com/group/will_paginate

Ruby port by: PJ Hyett, Mislav Marohnić (Sulien)
Contributors: K. Adam Christensen, Chris Wanstrath, Dr. Nic Williams
Original announcement: http://errtheblog.com/post/929
Original PHP source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php

REPORT BUGS on Lighthouse: http://err.lighthouseapp.com/projects/466-plugins/overview

Contributors: Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen,
Mike Garey, Bence Golda, Matt Aimonetti, Charles Brian Quinn,
Desi McAdam, James Coglan, Matijs van Zuijlen

== Want Digg style?

Expand Down
5 changes: 4 additions & 1 deletion Rakefile
Expand Up @@ -17,7 +17,10 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.add(files)
rdoc.main = "README" # page to start on
rdoc.title = "will_paginate"
rdoc.template = File.exists?(t="/Users/chris/ruby/projects/err/rock/template.rb") ? t : "/var/www/rock/template.rb"

templates = %w[/Users/chris/ruby/projects/err/rock/template.rb /var/www/rock/template.rb]
rdoc.template = templates.find { |t| File.exists? t }

rdoc.rdoc_dir = 'doc' # rdoc output folder
rdoc.options << '--inline-source'
end
9 changes: 9 additions & 0 deletions lib/will_paginate.rb
@@ -0,0 +1,9 @@
# = You *will* paginate!
#
# First read about WillPaginate::Finder::ClassMethods, then see
# WillPaginate::ViewHelpers. The magical array you're handling
# in-between is WillPaginate::Collection.
#
# Happy paginating!
module WillPaginate
end
4 changes: 2 additions & 2 deletions lib/will_paginate/finder.rb
@@ -1,6 +1,6 @@
module WillPaginate
# A mixin for ActiveRecord::Base. Provides `per_page` class method
# and makes `paginate` finders possible with some method_missing magic.
# A mixin for ActiveRecord::Base. Provides +per_page+ class method
# and makes +paginate+ finders possible with some method_missing magic.
#
# Find out more in WillPaginate::Finder::ClassMethods
#
Expand Down

0 comments on commit c7ec4a5

Please sign in to comment.