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
merged 2 commits into from Jun 19, 2018

Conversation

Projects
None yet
4 participants
@KevinSjoberg
Contributor

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

Contributor

@simi it's not. I was a bit too fast with pushing my changes. I've updated the commit accordingly.

Convert hashes into parameters
Ensure `ActionController::Parameters#transform_values` and
`ActionController::Parameters#transform_values!` converts hashes into
parameters.
@eileencodes

This comment has been minimized.

Member

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

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.

@KevinSjoberg

@rafaelfranca rafaelfranca self-assigned this Jun 8, 2018

@KevinSjoberg

This comment has been minimized.

Contributor

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

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 (#33076)
* 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