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:
commit
2efad3fc7f
1 changed files with 13 additions and 0 deletions
13
README.md
13
README.md
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue