class ActionDispatch::Request

def original_url

request.original_url # => "http://www.example.com/articles?page=2"
# get "/articles?page=2"

Returns the original request URL as a +String+.
def original_url
  base_url + original_fullpath
end