api-pagination icon indicating copy to clipboard operation
api-pagination copied to clipboard

Allow configuration overrides from request options

Open StefSchenkelaars opened this issue 5 years ago • 0 comments

In my own projects I was required to change the configuration on request basis. For example you have /api/v1 which uses a different header name for the page than /api/v2. Using a configuration block in a before action like

before do
  ApiPagination.configure do |config|
    config.include_total = false
  end
end

is not thread safe and will thus not work on servers like puma. Therefore I've added the option to override configs through the paginate options hash. In theory you can even change the paginator between requests.

Hope you like the idea!

StefSchenkelaars avatar Aug 17 '18 14:08 StefSchenkelaars