From 689cca132a7da77c80637a938740f40277384fe9 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Thu, 8 Sep 2005 11:28:54 +0000 Subject: Performance improvements to CGI methods. Closes #1980 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2151 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_controller/cgi_ext/cgi_methods.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller/cgi_ext/cgi_methods.rb') 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 } -- cgit v1.2.3