Skip to content

Check url_for options params is hash before merging it into actual pa… #39616

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

Closed
wants to merge 1 commit into from

Conversation

simi
Copy link
Contributor

@simi simi commented Jun 13, 2020

This is based on #33256 (comment) and kaminari/kaminari#1025 (comment).

TL;DR; currently any application re-using params for url_for (as is for example used in popular kaminari gem) explodes when you add manually &params=whatever to url.

before

url_for(only_path: true, controller: "c", action: "a", params: "p")

TypeError: no implicit conversion of String into Hash                       
    /home/retro/code/oss/rails/actionpack/lib/action_dispatch/routing/route_set.rb:829:in `merge!'
    /home/retro/code/oss/rails/actionpack/lib/action_dispatch/routing/route_set.rb:829:in `url_for'
    /home/retro/code/oss/rails/actionpack/lib/action_dispatch/routing/url_for.rb:181:in `full_url_for'
    /home/retro/code/oss/rails/actionpack/lib/action_dispatch/routing/url_for.rb:171:in `url_for'
    /home/retro/code/oss/rails/actionpack/test/controller/url_for_test.rb:366:in `test_params_string_option'

after (it is ignored)

url_for(only_path: true, controller: "c", action: "a", params: "p") #=> "/c/a"

@simi
Copy link
Contributor Author

simi commented Jun 14, 2020

ℹ️ I have left some info regarding this (and also another problem) at kaminari original issue as well.

kaminari/kaminari#1025 (comment)

@rails-bot
Copy link

rails-bot bot commented Sep 12, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant