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
Make AC::Parameters not inherited from Hash #20868
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,10 @@ def url_for(options = nil) | |
route_name = options.delete :use_route | ||
_routes.url_for(options.symbolize_keys.reverse_merge!(url_options), | ||
route_name) | ||
when ActionController::Parameters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. There actually are tests that failed if I didn't modify this line, though. I'll let you decide if you want to get #20797 in first and have me rebase it or not. |
||
route_name = options.delete :use_route | ||
_routes.url_for(options.to_unsafe_h.symbolize_keys. | ||
reverse_merge!(url_options), route_name) | ||
when String | ||
options | ||
when Symbol | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ class UsersController < ActionController::API | |
wrap_parameters :person, format: [:json] | ||
|
||
def test | ||
self.last_parameters = params.except(:controller, :action) | ||
self.last_parameters = params.except(:controller, :action).to_unsafe_h | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but because of #18006 Since this test is testing all parameters and doesn't care about Strong Parameters, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that is that I thought 👍 |
||
head :ok | ||
end | ||
end | ||
|
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.
Does this need to convert all incoming hashes to HWIAs? Or can we change initialize to:
I want to make sure the constructor is doing as little work as possible.
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.
I tried to change the constructor to not calling
.with_indifferent_access
but that totally broke the tests. I think it's better to keep it like that to make sure that params we are dealing with is HWIA. I feel like we'll run into weird issue if we don't do that.