Skip to content

Instantly share code, notes, and snippets.

@sharnik
Created November 4, 2008 10:59
Show Gist options
  • Save sharnik/22116 to your computer and use it in GitHub Desktop.
Save sharnik/22116 to your computer and use it in GitHub Desktop.
module ActionController
class AbstractRequest
class << self
def parse_query_parameters(query_string)
return {} if query_string.blank?
query_string = query_string.gsub("amp;", "")
pairs = query_string.split('&').collect do |chunk|
next if chunk.empty?
key, value = chunk.split('=', 2)
next if key.empty?
value = value.nil? ? nil : CGI.unescape(value)
[ CGI.unescape(key), value ]
end.compact
UrlEncodedPairParser.new(pairs).result
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment