id |
name |
1 |
Jane |
2 |
Max |
3 |
John |
4 |
Scott |
5 |
Mark |
result = User.after(3)
=>
[
{ id: 4, name: "Scott" },
{ id: 5, name: "Mark" }
]
result.has_more?
=> false
result.total_size
=> 2
result.total_count
=> 6
result = User.before(3)
=>
[
{ id: 2, name: "Max" },
{ id: 1, name: "Jane" }
]
result.has_more?
=> false
result.total_size
=> 2
result.total_count
=> 6
result = User.after(1).limit(1)
=>
[
{ id: 2, name: "Max" }
]
result.has_more?
=> true
result.total_size
=> 5
result.total_count
=> 6
result = User.after(1).before(3)
=>
[
{ id: 2, name: "Max" }
]
result.has_more?
=> false
result.total_size
=> 1
result.total_count
=> 6
@jerrygreen you can always sort by name, id.