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

Rails 6.1 bug involving params with a nested param named param #68

Open
sholden opened this issue Apr 20, 2021 · 0 comments
Open

Rails 6.1 bug involving params with a nested param named param #68

sholden opened this issue Apr 20, 2021 · 0 comments

Comments

@sholden
Copy link

sholden commented Apr 20, 2021

When calling get :action, params: { params: 'string' }, RouteSet#url_for is trying to merge! the inner params string into the params hash.

https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/routing/route_set.rb#L826

I added a failing test here:

https://github.com/sholden/rails-controller-testing/blob/bug/merge-nested-params/test/controllers/template_assertions_test.rb#L190

The issue came up while migrating to 6.1, looking into writing a failing spec directly in rails/rails, rather than through controller testing, but this one helped pinpoint the issue as it showed up in our code.

We could change RouteSet to check if options.key?(:params) && options[:params].is_a?(Hash) before attempting a merge, but maybe there's a better way?

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

1 participant