Rails - Get the current url without the GET parameters
request.path
should return what you're looking for if you're not concerned about the hostname. Otherwise you might try:
url_for(:only_path => false, :overwrite_params=>nil)
To get the request URL without any query parameters.
def current_url_without_parameters request.base_url + request.pathend
I use the following:
request.original_url.split('?').first
It does not regenerate the path, and therefore gives you exactly the url that the end-user sees in their browser, minus query parameters.