Skip to content

Instantly share code, notes, and snippets.

@samgro
Created October 28, 2011 21:50
Show Gist options
  • Save samgro/1323672 to your computer and use it in GitHub Desktop.
Save samgro/1323672 to your computer and use it in GitHub Desktop.
One liner for converting a params hash to url encoded string
def hash_to_url_params(params)
'?' + URI.encode(params.map { |key, value| "#{key}=#{value}" }.join('&'))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment