我试图找到一种将部分url路径段连接在一起的可靠方法.有快速的方法吗?
我尝试了以下方法:
puts URI::join('resource/', '/edit', '12?option=test')
Run Code Online (Sandbox Code Playgroud)
我预计:
resource/edit/12?option=test
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
`merge': both URI are relative (URI::BadURIError)
Run Code Online (Sandbox Code Playgroud)
我File.join()过去曾经使用过这个,但是对于使用url文件库来说似乎并不正确.