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

[ci skip] Add information about total_count to readme documentation

This commit is contained in:
Anton Davydov 2015-03-02 15:40:59 +03:00
parent baf4704978
commit 0ec80b85c0

View file

@ -61,10 +61,12 @@ Then bundle:
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.
Keep in mind that +per+ utilizes internally +limit+ and so it will override any +limit+ that was set previously
User.count # => 1000
a = User.limit(5); a.count # => 5
b = a.page(1).per(20).size # => 20
Keep in mind that +per+ utilizes internally +limit+ and so it will override any +limit+ that was set previously.
And if you want get size for all request records you can use +total_count+ method:
User.count # => 1000
a = User.limit(5); a.count # => 5
a.page(1).per(20).size # => 20
a.page(1).per(20).total_count # => 1000
* the +padding+ scope