diff options
author | Jamis Buck <jamis@37signals.com> | 2006-03-17 23:15:20 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-03-17 23:15:20 +0000 |
commit | 1340eb1a7ea19a9356cc041d084abb8d553ee529 (patch) | |
tree | d6e4f52ed4f4b740d6ae326d9e4e2290ec075ad0 | |
parent | d4b27a0b36109c6ded5dba57db63d4ff12ec74d1 (diff) | |
download | rails-1340eb1a7ea19a9356cc041d084abb8d553ee529.tar.gz rails-1340eb1a7ea19a9356cc041d084abb8d553ee529.tar.bz2 rails-1340eb1a7ea19a9356cc041d084abb8d553ee529.zip |
Be sure to look at array elements when dasherizing keys of a formatted request
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-x | actionpack/lib/action_controller/cgi_ext/cgi_methods.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb index cd70836c6e..776f74a100 100755 --- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb @@ -80,15 +80,17 @@ class CGIMethods #:nodoc: 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]', |