Module: FetcheableOnApi::Pageable
- Defined in:
- lib/fetcheable_on_api/pageable.rb
Overview
Pageable implements support for JSONAPI-compliant pagination via ‘page` query parameters.
This module enables controllers to process pagination parameters in the format: ‘page=2&page=25` following the JSONAPI specification for page-based pagination.
It handles the controller parameters:
-
‘page` - The requested page number (default: 1)
-
‘page` - Number of records per page (default: from configuration)
If no ‘page` parameter is present on the request, the full collection is returned.
The following pagination information is automatically added to response headers:
-
‘Pagination-Current-Page` - The page number that is returned
-
‘Pagination-Per` - The number of records included in the page
-
‘Pagination-Total-Pages` - The total number of pages available
-
‘Pagination-Total-Count` - The total number of records available