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

Merge pull request #863 from MatsumotoHiroko/master

add methods: getting page numbers or conditions
This commit is contained in:
Akira Matsuda 2017-02-11 21:56:45 +09:00 committed by GitHub
commit 2efad3fc7f

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)