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
Convert hashes into parameters #33076
Convert hashes into parameters #33076
Conversation
@@ -1,7 +1,7 @@ | |||
# frozen_string_literal: true | |||
|
|||
require "abstract_unit" | |||
require "action_controller/metal/strong_parameters" | |||
require_relative "../../../lib/action_controller/metal/strong_parameters" |
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.
Why is this change needed? ❓
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.
@simi it's not. I was a bit too fast with pushing my changes. I've updated the commit accordingly.
Ensure `ActionController::Parameters#transform_values` and `ActionController::Parameters#transform_values!` converts hashes into parameters.
db3cb12
to
90b5fb6
Compare
@@ -640,19 +640,17 @@ def extract!(*keys) | |||
# params.transform_values { |x| x * 2 } | |||
# # => <ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false> | |||
def transform_values(&block) |
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.
Can you remove the block variable now that it is no used?
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 can. I deliberately left it there since the other method signatures seemed to keep it even though they called the block implicitly.
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.
@rafaelfranca see cb17cb2.
@sikachu @rafaelfranca is this good to go? |
* Convert hashes into parameters Ensure `ActionController::Parameters#transform_values` and `ActionController::Parameters#transform_values!` converts hashes into parameters. * fixup! Convert hashes into parameters [Rafael Mendonça França + Kevin Sjöberg]
This is my first pull request to Rails, be gentle. 🙂
Summary
Ensure
ActionController::Parameters#transform_values
andActionController::Parameters#transform_values!
converts hashes intoparameters.
Closes #33044.
Other Information