Skip to content

Instantly share code, notes, and snippets.

@dkam
Created September 15, 2023 05:15
Show Gist options
  • Save dkam/9f5daceeff10f2b87d9301bd12e387d8 to your computer and use it in GitHub Desktop.
Save dkam/9f5daceeff10f2b87d9301bd12e387d8 to your computer and use it in GitHub Desktop.
Add query parameter with URI
URI(url).tap {|u| u.query = URI.encode_www_form(CGI.parse(u.query || "").merge({ref: 123})) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment