:page_facing_up: Link header pagination for Rails and Grape APIs.
This release fixes issues with using newer versions of Pagy, due to them renaming Pagy::VARS
to Pagy::DEFAULT
. Consequently, support for older versions of Pagy is dropped.
This release fixes an incompatibility with Grape 1.2. Thanks to @fotos for this fix!
Add an :enforce_max_per_page
option to pagination in Grape APIs:
class MoviesAPI < Grape::API
format :json
desc 'Return a paginated set of movies'
paginate per_page: 25, max_per_page: 100, enforce_max_per_page: true
get do
# If a client tries to make a request with a `per_page` param that is above 100,
# no movies will be returned. Instead, a client error will be returned.
paginate Movie.all
end
end
This release allows users to configure a hardcoded base URL for pagination links in the case where your application is reachable at multiple URLs and, for example, caching is used. If your application is only available at specific hostnames for specific users, caching these headers can lead to unexpected results. You can set a base URL using the following configuration:
ApiPagination.configure do |config|
# Hardcode a URL to use in your pagination links (without a trailing slash)
config.base_url = 'https://example.com'
end
Fix a regression that broke compatibility with multi-word classes (#84)
Removes a superfluous database query (#82)
Fixes an issue with will_paginate where unsupported options were passed
last_page?
in Kaminari (#78)paginate
when using will_paginate
(#81)Fix an issue where Total
headers supplied as non-String values would cause exceptions in Rack