Skip to content

Instantly share code, notes, and snippets.

@bricker
Created February 13, 2014 20:15
Show Gist options
  • Save bricker/8982965 to your computer and use it in GitHub Desktop.
Save bricker/8982965 to your computer and use it in GitHub Desktop.
def url_with_params(url, params={})
uri = URI.parse(url)
query = URI.decode_www_form(uri.query.to_s)
params.each { |k, v| query << [k.to_s, v.to_s] }
uri.query = URI.encode_www_form(query)
uri.to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment