diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2005-09-08 11:28:54 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2005-09-08 11:28:54 +0000 |
commit | 689cca132a7da77c80637a938740f40277384fe9 (patch) | |
tree | 8f3a0745c7d2e59313e1de1ee61eaf6dbe60515e /actionpack/lib/action_controller/cgi_ext | |
parent | 7b235f0213599c4c20966f89889baba3b8ad7006 (diff) | |
download | rails-689cca132a7da77c80637a938740f40277384fe9.tar.gz rails-689cca132a7da77c80637a938740f40277384fe9.tar.bz2 rails-689cca132a7da77c80637a938740f40277384fe9.zip |
Performance improvements to CGI methods. Closes #1980
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2151 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/cgi_ext')
-rwxr-xr-x | actionpack/lib/action_controller/cgi_ext/cgi_methods.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb index d922e48b10..3a14311acf 100755 --- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb @@ -17,13 +17,17 @@ class CGIMethods #:nodoc: k = CGI.unescape(k) if k v = CGI.unescape(v) if v - keys = split_key(k) - last_key = keys.pop - last_key = keys.pop if (use_array = last_key.empty?) - parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}} - - if use_array then (parent[last_key] ||= []) << v - else parent[last_key] = v + unless k.include?(?[) + parsed_params[k] = v + else + keys = split_key(k) + last_key = keys.pop + last_key = keys.pop if (use_array = last_key.empty?) + parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}} + + if use_array then (parent[last_key] ||= []) << v + else parent[last_key] = v + end end } |