diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/cgi_ext/parameters.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 3 |
2 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/parameters.rb b/actionpack/lib/action_controller/cgi_ext/parameters.rb index d84d0e72e8..5eff896d18 100644 --- a/actionpack/lib/action_controller/cgi_ext/parameters.rb +++ b/actionpack/lib/action_controller/cgi_ext/parameters.rb @@ -23,8 +23,9 @@ module ActionController end module ClassMethods - # DEPRECATED: Use parse_form_encoded_parameters def parse_query_parameters(query_string) + return {} if query_string.blank? + pairs = query_string.split('&').collect do |chunk| next if chunk.empty? key, value = chunk.split('=', 2) @@ -33,12 +34,11 @@ module ActionController [ CGI.unescape(key), value ] end.compact - FormEncodedPairParser.new(pairs).result + UrlEncodedPairParser.new(pairs).result end - # DEPRECATED: Use parse_form_encoded_parameters def parse_request_parameters(params) - parser = FormEncodedPairParser.new + parser = UrlEncodedPairParser.new params = params.dup until params.empty? @@ -112,7 +112,7 @@ module ActionController end end - class FormEncodedPairParser < StringScanner #:nodoc: + class UrlEncodedPairParser < StringScanner #:nodoc: attr_reader :top, :parent, :result def initialize(pairs = []) diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 13467be8ef..40a533ad6f 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -69,8 +69,7 @@ module ActionController #:nodoc: end def query_parameters - @query_parameters ||= - (qs = self.query_string).empty? ? {} : CGI.parse_query_parameters(qs) + @query_parameters ||= CGI.parse_query_parameters(query_string) end def request_parameters |