The method you are looking for request_uri
uri.request_uri
=> "/posts?id=30&limit=5"
You can use any method that you would like to remove if necessary /.
Edit: To get the item after the mark #, use fragment:
[uri.request_uri, uri.fragment].join("#")
=> "/posts?id=30&limit=5#time=1305298413"