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

Convert hashes into parameters #33076

Merged

Conversation

hovsater
Copy link
Contributor

@hovsater hovsater commented Jun 7, 2018

This is my first pull request to Rails, be gentle. 🙂

Summary

Ensure ActionController::Parameters#transform_values and
ActionController::Parameters#transform_values! converts hashes into
parameters.

Closes #33044.

Other Information

@@ -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"
Copy link
Contributor

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? ❓

Copy link
Contributor Author

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.
@hovsater hovsater force-pushed the strong-parameters/transform-values branch from db3cb12 to 90b5fb6 Compare June 7, 2018 09:30
@eileencodes
Copy link
Member

cc/ @sikachu a fix you requested for #33044

@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafaelfranca rafaelfranca self-assigned this Jun 8, 2018
@hovsater
Copy link
Contributor Author

@sikachu @rafaelfranca is this good to go?

@rafaelfranca rafaelfranca merged commit 716f2e0 into rails:master Jun 19, 2018
rafaelfranca pushed a commit that referenced this pull request Jun 19, 2018
* 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]
@hovsater hovsater deleted the strong-parameters/transform-values branch June 19, 2018 21:11
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

Successfully merging this pull request may close these issues.

None yet

4 participants