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

Query string parameters name clashes #89

Open
Aethelflaed opened this issue Jun 24, 2019 · 1 comment
Open

Query string parameters name clashes #89

Aethelflaed opened this issue Jun 24, 2019 · 1 comment

Comments

@Aethelflaed
Copy link

Hi!
It's currently not possible to have a query string parameter like distance, as it would most probably cause scrivener_html to raise ArithmeticError or at least have some undesired side-effect.

This is due to the fact that there is no distinction between pagination_links's own keywords and the possible query string parameter we can provide.

The workaround I found was to have a separate data structure with my query parameters, and to use the :path parameter to point not directly to a route helper but to another function, which will take the initial @conn and my data structure and make the call to the route helper.

Would it be possible to accept an anonymous function for example, which would be called with just the pagination parameters?

This would help keep a clean API, and even maybe remove the @conn parameter (as far as I can tell it's only used for the path, but is passed around all the way to raw_pagination_links...)

If this is OK for you I can try to implement this, but it may induce an API change, hence the discussion.

@mgwidmann
Copy link
Owner

mgwidmann commented Jul 19, 2019

In order to preserve the current API, we could instead just accept a query option and everything in there would get merged as query string parameters in addition to the existing implementation for backwards compatibility. What do you think about that instead?

If you think that is acceptable, I'd be willing to accept a PR for it.

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

No branches or pull requests

2 participants