Skip to content

Commit

Permalink
recurse for arrays in normalize_encode_params
Browse files Browse the repository at this point in the history
this just pushes the conditional in to the case / when so we can switch
to method dispatch later
  • Loading branch information
tenderlove committed Jul 22, 2015
1 parent 5046d51 commit 14e8377
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions actionpack/lib/action_dispatch/http/parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ def path_parameters
#
def normalize_encode_params(params)
case params
when Array
params.map! { |el| normalize_encode_params(el) }
when Hash
if params.has_key?(:tempfile)
UploadedFile.new(params)
else
params.each_with_object({}) do |(key, val), new_hash|
new_hash[key] = if val.is_a?(Array)
val.map! { |el| normalize_encode_params(el) }
else
normalize_encode_params(val)
end
new_hash[key] = normalize_encode_params(val)
end.with_indifferent_access
end
else
Expand Down

0 comments on commit 14e8377

Please sign in to comment.