-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Do not overwrite route_param with a regular one if they share same name #2378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! See below.
@dblock could you please take a look, I made all the requested changes but PR is still in "changes requested" state for some reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good.
Looking at this deeper, it sounds like we're changing the undocumented/undefined behavior of a regular param overriding a route param before?
- Is that the right thing to do? Why wouldn't a regular parameter specified by the caller override a route parameter?
- Does anything change if I declare a regular parameter over a route parameter for the
get
API in your example? Add a spec for that. - Document this behavior in README.
- This is a behavior change, but not breaking since it wasn't documented. Either way add a section to UPGRADING.
@arg want to finish this? |
Yes, I will. A bit busy now but will try to find some time in the next few days. |
@dblock
NOTE: deep_symbolize_keys_in({"id" => nil}.merge(id: '123'))
#=> {:id=>"123"}
{"id" => nil}.merge(id: '123').deep_symbolize_keys
#=> {:id=>"123"} However {"id" => nil}.merge(id: '123').deep_symbolize_keys!
#=> {:id=>nil} The priority works for |
@DmytroVasin thanks for the deep dive, makes sense, let's get this PR finished and make sure we have the right specs - is there anything else missing here? |
@dblock so what are the changes to make? Just the API test and README note? |
I think so, basically what I said in #2378 (review). Thanks for picking this up! |
@arg Any updates on this? Sorry for disturbing you, but I can proceed with completing this MR if you don't mind |
@dblock @DmytroVasin sorry, have been quite busy the last couple of months. So anyways, I added test to cover scenario when both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have some more asks, mostly in README/UPGRADING.
@arg Any updates on this? Sorry for annoying you :) |
@DmytroVasin want to finish this PR for @arg? |
Hey, thanks for reminding and sorry for the delay. I’m coming back tomorrow and will try to find some time to finish the PR.
|
It looks like all requested changes are applied, please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted one typo, otherwise good to go!
@dblock ready to merge |
Thanks for the good work and for hanging in here with my OCD! |
#2326 changed the behavior of params merging. Before v1.8.0 the following route:
would return
{ id: 12345 }
if called asNow, since v1.8.0, it returns
{ id: 1 }
asid
passed in params overwritesroute_param
.This PR restores the previous behavior.