module Clear::SQL::Query::WithPagination
Direct including types
Defined in:
clear/sql/query/with_pagination.crConstant Summary
-
DEFAULT_LIMIT =
50
-
DEFAULT_PAGE =
1
Instance Method Summary
-
#current_page
Return the current page
- #first_page?
- #last_page?
-
#next_page
Return
current_page + 1
ornil
if there is no next page -
#out_of_bounds?
Helper method that is true when someone tries to fetch a page with a larger number than the last page.
-
#paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT)
Enter pagination mode.
-
#per_page
Return the number of items maximum per page.
-
#previous_page
Return
current_page - 1
ornil
if there is no previous page -
#total_pages
Return the total number of pages.
Instance Method Detail
def out_of_bounds?
#
Helper method that is true when someone tries to fetch a page with a larger number than the last page. Can be used in combination with flashes and redirecting.
Enter pagination mode.
This is helpful to manage paginated table.
Pagination will handle the page progression automatically and update
offset
and limit
parameters by his own.
page = query.paginate(2, 50)