rails urlからパラメータを削除する

これを
https://example.com/?p=1&o=2

これにしたいだけ
https://example.com/

url = 'https://example.com/?p=1&o=2'
uri = URI(url)
"#{uri.scheme}://#{uri.host}#{uri.path}"

以上です