public
Rubygem
Description: Most awesome pagination solution for Ruby
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/mislav/will_paginate.git
bump version number to 2.5.0 and update README
mislav (author)
Sat Jun 07 19:33:15 -0700 2008
commit  c5db3e43a530a4da64ac40118e06eb9a63634812
tree    31015dacb9c213d3d17e9623f7e130dc4eb51cfb
parent  c1856887318e69daf001f39c642dfda429ff20c9
...
1
2
3
4
5
 
 
 
 
6
7
8
9
10
 
11
12
13
14
15
16
17
18
19
 
 
 
 
 
20
21
22
23
24
25
26
27
28
29
 
 
 
 
30
31
32
33
 
34
35
 
 
 
 
36
37
38
39
 
40
41
42
43
 
 
 
44
45
46
47
48
49
50
 
 
 
 
 
51
52
53
54
 
 
55
56
57
 
 
58
59
60
61
62
 
 
63
64
65
 
 
66
67
68
69
 
70
71
72
73
74
75
76
77
78
79
80
81
 
 
82
83
84
85
86
87
 
 
 
88
89
90
...
97
98
99
100
 
101
102
103
...
107
108
109
110
111
 
 
112
113
114
115
116
 
 
 
 
117
118
119
120
121
122
 
 
123
124
125
126
127
128
129
130
131
132
133
134
 
 
 
135
 
 
136
...
1
2
 
 
 
3
4
5
6
7
8
9
 
 
10
11
12
13
 
 
 
 
 
 
14
15
16
17
18
19
20
21
22
23
 
 
 
 
 
24
25
26
27
28
 
 
 
29
30
 
31
32
33
34
35
36
 
 
37
38
 
 
 
39
40
41
42
43
44
45
46
47
 
48
49
50
51
52
53
 
 
 
54
55
56
 
 
57
58
59
60
61
 
 
62
63
64
 
 
65
66
67
68
 
 
69
70
71
 
 
 
 
 
 
 
 
 
 
72
73
74
75
76
 
 
 
77
78
79
80
81
82
...
89
90
91
 
92
93
94
95
...
99
100
101
 
 
102
103
104
 
 
 
 
105
106
107
108
109
110
111
112
 
 
113
114
115
116
117
 
 
 
 
 
 
 
 
 
118
119
120
121
122
123
124
0
@@ -1,90 +1,82 @@
0
 = WillPaginate
0
 
0
-Pagination is just limiting the number of records displayed. Why should you let
0
-it get in your way while developing, then? This plugin makes magic happen. Did
0
-you ever want to be able to do just this on a model:
0
+Pagination is just limiting the number of records displayed. Why should you let it get in your way
0
+while developing?
0
+
0
+This is how you paginate on an ActiveRecord model:
0
 
0
   Post.paginate :page => 1, :order => 'created_at DESC'
0
 
0
-... and then render the page links with a single view helper? Well, now you
0
-can.
0
+Most of the time it's as simple as replacing "find" with "paginate" and specifying the page you want.
0
 
0
 Some resources to get you started:
0
 
0
-* Your mind reels with questions? Join our
0
- {Google group}[http://groups.google.com/group/will_paginate].
0
-* The will_paginate project page: http://github.com/mislav/will_paginate
0
-* How to report bugs: http://github.com/mislav/will_paginate/wikis/report-bugs
0
-* Ryan Bates made an awesome screencast[http://railscasts.com/episodes/51],
0
- check it out.
0
+* The {will_paginate project page}[http://github.com/mislav/will_paginate];
0
+* Your mind reels with questions? Join our {Google group}[http://groups.google.com/group/will_paginate];
0
+* {How to report bugs}[http://github.com/mislav/will_paginate/wikis/report-bugs];
0
+* {Watch the will_paginate screencast}[http://railscasts.com/episodes/51] by Ryan Bates.
0
+
0
 
0
 == Installation
0
 
0
 The recommended way is that you get the gem:
0
 
0
- # add GitHub to your local list of gem sources:
0
- gem sources -a http://gems.github.com/
0
-
0
- # install the gem:
0
- gem install mislav-will_paginate
0
+ gem install --source=http://gems.github.com/ mislav-will_paginate
0
+
0
+After that you don't need the will_paginate <i>plugin</i> in your Rails application anymore. In
0
+<b>Rails 2.1</b>, add a gem dependency:
0
 
0
-After that you don't need the will_paginate <i>plugin</i> in your Rails
0
-application anymore. Just add a simple require to the end of
0
-"config/environment.rb":
0
+ config.gem 'mislav-will_paginate', :lib => 'will_paginate', :version => '~> 2.5'
0
 
0
- gem 'mislav-will_paginate', '~> 2.2'
0
+If you're using Rails 2.0 or older, just add a simple require to the end of your
0
+"config/environment.rb" instead:
0
+
0
+ gem 'mislav-will_paginate', '~> 2.5'
0
   require 'will_paginate'
0
 
0
-That's it. Remember to install the gem on <b>all</b> machines that you are
0
-deploying to.
0
+That's it. Remember to install the gem on <b>all</b> machines that you are deploying to.
0
 
0
-<i>There are extensive
0
-{installation instructions}[http://github.com/mislav/will_paginate/wikis/installation]
0
-on {the wiki}[http://github.com/mislav/will_paginate/wikis].</i>
0
+<i>There are extensive {installation
0
+instructions}[http://github.com/mislav/will_paginate/wikis/installation] on {the
0
+wiki}[http://github.com/mislav/will_paginate/wikis].</i>
0
 
0
 
0
 == Example usage
0
 
0
 Use a paginate finder in the controller:
0
 
0
- @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC'
0
+ @posts = Post.paginate_by_board_id(
0
+ @board.id,
0
+ :page => params[:page],
0
+ :order => 'updated_at DESC'
0
+ )
0
 
0
-Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the
0
-records. Don't forget to tell it which page you want, or it will complain!
0
-Read more on WillPaginate::Finder::ClassMethods.
0
+Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the records. Don't forget to
0
+tell it which page you want, or it will complain! Read more about WillPaginate::Finders.
0
 
0
-Render the posts in your view like you would normally do. When you need to render
0
-pagination, just stick this in:
0
+Render the posts in your view like you would normally do. When you need to render pagination, just
0
+stick this in:
0
 
0
   <%= will_paginate @posts %>
0
 
0
-You're done. (Copy and paste the example fancy CSS styles from the bottom.) You
0
-can find the option list at WillPaginate::ViewHelpers.
0
+You're done. (Copy and paste the example fancy CSS styles from the bottom.) You can find the option
0
+list at WillPaginate::ViewHelpers.
0
 
0
-How does it know how much items to fetch per page? It asks your model by calling
0
-its <tt>per_page</tt> class method. You can define it like this:
0
+How does it know how much items to fetch per page? It asks your model by calling its
0
+<tt>per_page</tt> class method. You can define it like this:
0
 
0
   class Post < ActiveRecord::Base
0
- cattr_reader :per_page
0
- @@per_page = 50
0
+ def self.per_page() 50 end
0
   end
0
 
0
-... or like this:
0
-
0
- class Post < ActiveRecord::Base
0
- def self.per_page
0
- 50
0
- end
0
- end
0
-
0
-... or don't worry about it at all. WillPaginate defines it to be <b>30</b> by default.
0
-But you can always specify the count explicitly when calling +paginate+:
0
+... or don't worry about it at all. WillPaginate defines it to be <b>30</b> by default. You can
0
+always specify the count explicitly when calling +paginate+:
0
 
0
   @posts = Post.paginate :page => params[:page], :per_page => 50
0
 
0
-The +paginate+ finder wraps the original finder and returns your resultset that now has
0
-some new properties. You can use the collection as you would with any ActiveRecord
0
-resultset. WillPaginate view helpers also need that object to be able to render pagination:
0
+The +paginate+ finder wraps the original finder and returns your result set that now has some new
0
+properties. You can use the collection as you would use any other array. WillPaginate view helpers
0
+also need that object to be able to render pagination:
0
 
0
   <ol>
0
     <% for post in @posts -%>
0
@@ -97,7 +89,7 @@ resultset. WillPaginate view helpers also need that object to be able to render
0
 
0
 More detailed documentation:
0
 
0
-* WillPaginate::Finder::ClassMethods for pagination on your models;
0
+* WillPaginate::Finders for pagination on your models;
0
 * WillPaginate::ViewHelpers for your views.
0
 
0
 
0
@@ -107,29 +99,25 @@ Authors:: Mislav Marohnić, PJ Hyett
0
 Original announcement:: http://errtheblog.com/post/929
0
 Original PHP source:: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
0
 
0
-All these people helped making will_paginate what it is now with their code
0
-contributions or just simply awesome ideas:
0
+All these people helped making will_paginate what it is now with their code contributions or just
0
+simply awesome ideas:
0
 
0
-Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence
0
-Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs
0
-van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel,
0
-Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris Eppstein.
0
+Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence Golda, Matt Aimonetti,
0
+Charles Brian Quinn, Desi McAdam, James Coglan, Matijs van Zuijlen, Maria, Brendan Ribera, Todd
0
+Willey, Bryan Helmkamp, Jan Berkel, Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris
0
+Eppstein.
0
 
0
 
0
 == Usable pagination in the UI
0
 
0
-There are some CSS styles to get you started in the "examples/" directory. They
0
-are showcased in the <b>"examples/index.html"</b> file.
0
+There are some CSS styles to get you started in the "examples/" directory. They are showcased in the
0
+<b>"examples/index.html"</b> file.
0
 
0
 More reading about pagination as design pattern:
0
 
0
-* Pagination 101:
0
- http://kurafire.net/log/archive/2007/06/22/pagination-101
0
-* Pagination gallery:
0
- http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/
0
-* Pagination on Yahoo Design Pattern Library:
0
- http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination
0
-
0
-Want to discuss, request features, ask questions? Join the
0
-{Google group}[http://groups.google.com/group/will_paginate].
0
+* {Pagination 101}[http://kurafire.net/log/archive/2007/06/22/pagination-101];
0
+* {Pagination gallery}[http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/] featured on Smashing Magazine;
0
+* {Pagination design pattern}[http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination] on Yahoo Design Pattern Library.
0
 
0
+Want to discuss, request features, ask questions? Join the {Google
0
+group}[http://groups.google.com/group/will_paginate].
0
\ No newline at end of file
...
1
2
3
4
5
 
 
6
7
8
...
1
2
3
 
 
4
5
6
7
8
0
@@ -1,8 +1,8 @@
0
 module WillPaginate #:nodoc:
0
   module VERSION #:nodoc:
0
     MAJOR = 2
0
- MINOR = 3
0
- TINY = 1
0
+ MINOR = 5
0
+ TINY = 0
0
 
0
     STRING = [MAJOR, MINOR, TINY].join('.')
0
   end
...
1
2
3
4
 
 
5
6
7
 
 
8
9
10
...
14
15
16
17
18
19
20
21
 
22
...
1
2
 
 
3
4
5
 
 
6
7
8
9
10
...
14
15
16
 
17
18
19
 
20
21
0
@@ -1,10 +1,10 @@
0
 Gem::Specification.new do |s|
0
   s.name = 'will_paginate'
0
- s.version = '2.3.1'
0
- s.date = '2008-05-04'
0
+ s.version = '2.5.0'
0
+ # s.date = '2008-05-04'
0
   
0
- s.summary = "Most awesome pagination solution for Rails"
0
- s.description = "The will_paginate library provides a simple, yet powerful and extensible API for ActiveRecord pagination and rendering of pagination links in ActionView templates."
0
+ s.summary = "Most awesome pagination solution for every web app"
0
+ s.description = "The will_paginate library provides a simple, yet powerful and extensible API for pagination and rendering of page links in templates."
0
   
0
   s.authors = ['Mislav Marohnić', 'PJ Hyett']
0
   s.email = 'mislav.marohnic@gmail.com'
0
@@ -14,8 +14,7 @@ Gem::Specification.new do |s|
0
   s.rdoc_options = ['--main', 'README.rdoc']
0
   s.rdoc_options << '--inline-source' << '--charset=UTF-8'
0
   s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG']
0
- # s.add_dependency 'actionpack', ['>= 1.13.6']
0
   
0
   s.files = %w(CHANGELOG LICENSE README.rdoc Rakefile examples examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib lib/will_paginate lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/view_test.rb)
0
   s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/view_test.rb)
0
-end
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.