The result renders http://foobar.com/my_application.
This is expected. The #/applications/ is an anchor/fragment, not part of the path (path is /). For my_application, that is interpreted as the path, so it overwrites the path of the url. You get the same result for URI.join('http://foobar.com/', 'my_application').to_s.
Or in the case of executing an API marked by URNs so the ID field in my GET request is something like
The issue here is that 'urn:api:baz:1' is interpreted as a URI with scheme urn and opaque part api:baz:1, which overrides the entire url.
The URI.join documents the behavior: String(s) to work with, will be converted to RFC3986 URIs before merging..
You probably don't want to use URI.join in either example. You may want something like the following, but I'm not even sure of what URIs you are trying to generate: