Skip to content

Instantly share code, notes, and snippets.

@philm
Created October 19, 2011 16:22
Show Gist options
  • Save philm/1298819 to your computer and use it in GitHub Desktop.
Save philm/1298819 to your computer and use it in GitHub Desktop.
Querystring-like string to hash via Rack::Utils and ActiveSupport
Rack::Utils.parse_nested_query("foo=bar&ale=good").symbolize_keys
# => {:ale=>"good", :foo=>"bar"}
# Compared to CGI.parse approach:
CGI.parse("foo=bar&ale=good").symbolize_keys
# => {:ale=>["good"], :foo=>["bar"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment