1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

documentation

This commit is contained in:
Akira Matsuda 2011-02-22 13:06:03 +09:00
parent f9f529fb68
commit 3c44a21660
2 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,9 @@
== 0.10.2
* Added :param_name option to the pagination helper #10 [ivanvr]
Example:
= paginate @users, :param_name => :pagina
== 0.10.1 == 0.10.1
* Fixed a bug that the whole <nav> section was not rendered in some cases * Fixed a bug that the whole <nav> section was not rendered in some cases

View file

@ -47,16 +47,16 @@ Then bundle:
=== Query Basics === Query Basics
* the +:page+ scope * the +page+ scope
To fetch the 7th page of users (default +per_page+ is 25) To fetch the 7th page of users (default +per_page+ is 25)
User.page(7) User.page(7)
* the +:per+ scope * the +per+ scope
To show a lot more users per each page (change the +per_page+ value) To show a lot more users per each page (change the +per_page+ value)
User.page(7).per(50) User.page(7).per(50)
Note that the +:per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number. Note that the +per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number.
=== Configuring default +per_page+ value for each model === Configuring default +per_page+ value for each model
@ -100,6 +100,11 @@ Then bundle:
<%= paginate @users, :left => 0, :right => 2 %> <%= paginate @users, :left => 0, :right => 2 %>
This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total. This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total.
* changing the parameter name (:+param_name+) for the links
<%= paginate @users, :param_name => :pagina
This would modify the query parameter name on each links.
* extra parameters (:+params+) for the links * extra parameters (:+params+) for the links
<%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'}