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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert hashes into parameters #33076

Merged

Conversation

@kevinsjoberg
Copy link
Contributor

@kevinsjoberg kevinsjoberg 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

actionpack/test/controller/parameters/accessors_test.rb Outdated
@@ -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"

This comment has been minimized.

@simi

simi Jun 7, 2018
Contributor

Why is this change needed?

This comment has been minimized.

@kevinsjoberg

kevinsjoberg Jun 7, 2018
Author Contributor

@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.
@kevinsjoberg kevinsjoberg force-pushed the kevinsjoberg:strong-parameters/transform-values branch to 90b5fb6 Jun 7, 2018
@eileencodes
Copy link
Member

@eileencodes eileencodes commented Jun 7, 2018

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)

This comment has been minimized.

@rafaelfranca

rafaelfranca Jun 8, 2018
Member

Can you remove the block variable now that it is no used?

This comment has been minimized.

@kevinsjoberg

kevinsjoberg Jun 9, 2018
Author Contributor

I can. I deliberately left it there since the other method signatures seemed to keep it even though they called the block implicitly.

This comment has been minimized.

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

@kevinsjoberg kevinsjoberg commented Jun 19, 2018

@sikachu @rafaelfranca is this good to go?

@rafaelfranca rafaelfranca merged commit 716f2e0 into rails:master Jun 19, 2018
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
rafaelfranca added 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]
@kevinsjoberg kevinsjoberg deleted the kevinsjoberg:strong-parameters/transform-values branch Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants