Permalink
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...
1 parent d4b27a0 commit 1340eb1a7ea19a9356cc041d084abb8d553ee529 @jamis jamis committed Mar 17, 2006
Showing with 11 additions and 9 deletions.
  1. +11 −9 actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
View
20 actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -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]',

0 comments on commit 1340eb1

Please sign in to comment.