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

Add documentation for passing nil to #per

This commit is contained in:
Bryan Ricker 2012-11-03 13:08:09 -07:00
parent 949f345a50
commit 3b293cfca6

View file

@ -63,6 +63,10 @@ Then bundle:
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.
If you would like to specify "no limit" while still using the +per+ scope, you can pass +nil+:
User.count # => 1000
User.page(1).per(nil).size # => 1000
* the +padding+ scope * the +padding+ scope
Occasionally you need to padding a number of records that is not a multiple of the page size. Occasionally you need to padding a number of records that is not a multiple of the page size.