Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Be sure to look at array elements when dasherizing keys of a formatte…

…d request

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1340eb1a7ea19a9356cc041d084abb8d553ee529 1 parent d4b27a0
Jamis Buck jamis authored
Showing with 11 additions and 9 deletions.
  1. +11 −9 actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
20 actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
View
@@ -80,15 +80,17 @@ def self.parse_formatted_request_parameters(mime_type, raw_post_data)
private
def self.dasherize_keys(params)
- case params.class.to_s
- when "Hash"
- params.inject({}) do |h,(k,v)|
- h[k.tr("-", "_")] = dasherize_keys(v)
- h
- end
- else
- params
- end
+ case params.class.to_s
+ when "Hash"
+ params.inject({}) do |h,(k,v)|
+ h[k.to_s.tr("-", "_")] = dasherize_keys(v)
+ h
+ end
+ when "Array"
+ params.map { |v| dasherize_keys(v) }
+ else
+ params
+ end
end
# Splits the given key into several pieces. Example keys are 'name', 'person[name]',
Please sign in to comment.
Something went wrong with that request. Please try again.