Created
October 28, 2011 21:50
-
-
Save samgro/1323672 to your computer and use it in GitHub Desktop.
One liner for converting a params hash to url encoded string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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