Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration overrides from request options #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

StefSchenkelaars
Copy link
Contributor

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 StefSchenkelaars force-pushed the override-configuration-per-request branch from f2d3dac to 5eee138 Compare July 10, 2020 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant