I have to add a new param to an indeterminate URL, let\'s say param=value.
param=value
In case the actual URL has already params like this
http://url.co
More elegant solution:
url = 'http://example.com?exiting=0' params = {new_param: 1} uri = URI.parse url uri.query = URI.encode_www_form URI.decode_www_form(uri.query || '').concat(params.to_a) uri.to_s #=> http://example.com?exiting=0&new_param=1