Skip to content

Instantly share code, notes, and snippets.

@huobazi
Forked from pasberth/to_param.rb
Created July 28, 2011 00:20
Show Gist options
  • Save huobazi/1110654 to your computer and use it in GitHub Desktop.
Save huobazi/1110654 to your computer and use it in GitHub Desktop.
Key Value To QueryString
# h = { "key0"=>"value0", "key1"=>"value1", "key2"=>"value2" }
h.map { |k, v| "#{k}=#{v}" }.join('&')
# => "key0=value0&key1=value1&key2=value2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment