aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-15 23:56:09 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-15 23:56:09 +0000
commit9d1f1a86552417a3e4624a93d62a5dc73eb13826 (patch)
tree1bcea52ae8c0c00276f867c14f47af1895a79303 /actionpack/lib
parentf73e1c2ec0711782870b7935da84b40596ad3577 (diff)
downloadrails-9d1f1a86552417a3e4624a93d62a5dc73eb13826.tar.gz
rails-9d1f1a86552417a3e4624a93d62a5dc73eb13826.tar.bz2
rails-9d1f1a86552417a3e4624a93d62a5dc73eb13826.zip
Simplify CgiRequest#query_parameters
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6743 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/cgi_ext/parameters.rb10
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb3
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