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

add methods: getting page numbers or conditions

This commit is contained in:
Hiroko Matsumoto 2017-02-11 12:18:01 +00:00
parent 68d1308257
commit eb2acc135c

View file

@ -74,6 +74,19 @@ User.page(7)
Note: pagination starts at page 1, not at page 0 (page(0) will return the same results as page(1)).
You can get page numbers or page conditions by using below methods.
```ruby
User.count #=> 1000
User.page(1).limit_value #=> 20
User.page(1).total_pages #=> 50
User.page(1).current_page #=> 1
User.page(1).next_page #=> 2
User.page(2).prev_page #=> 1
User.page(1).first_page? #=> true
User.page(50).last_page? #=> true
User.page(100).out_of_range? #=> true
```
### The `per` Scope
To show a lot more users per each page (change the `per_page` value)