Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 2151

Show
Ignore:
Timestamp:
09/08/05 11:28:54 (3 years ago)
Author:
ulysses
Message:

Performance improvements to CGI methods. Closes #1980

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r2149 r2151  
    11*SVN* 
     2 
     3* Performance improvements to CGI methods. Closes #1980 [Skaes] 
    24 
    35* Added :post option to UrlHelper#link_to that makes it possible to do POST requests through normal ahref links using Javascript 
  • trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb

    r1905 r2151  
    1818        v = CGI.unescape(v) if v 
    1919 
    20         keys = split_key(k) 
    21         last_key = keys.pop 
    22         last_key = keys.pop if (use_array = last_key.empty?) 
    23         parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}} 
    24          
    25         if use_array then (parent[last_key] ||= []) << v 
    26         else parent[last_key] = v 
     20        unless k.include?(?[) 
     21          parsed_params[k] = v 
     22        else 
     23          keys = split_key(k) 
     24          last_key = keys.pop 
     25          last_key = keys.pop if (use_array = last_key.empty?) 
     26          parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}} 
     27           
     28          if use_array then (parent[last_key] ||= []) << v 
     29          else parent[last_key] = v 
     30          end 
    2731        end 
    2832      } 
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r1905 r2151  
    126126    private 
    127127      def new_session 
    128         CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => true)) 
     128        CGI::Session.new(@cgi, session_options_with_string_keys.update("new_session" => true)) 
    129129      end 
    130130       
    131131      def session_options_with_string_keys 
    132         DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, pair| options[pair.first.to_s] = pair.last; options } 
     132        DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, (k,v)| options[k.to_s] = v; options } 
    133133      end 
    134134  end