Rails 4 - What is the difference between request.original_fullpath and request.fullpath

I need to save search queries in our db to track search history. I know that request.original_url will provide me with a query string as an absolute url.

http://www.example.com/search?utf8=%E2%9C%93&keywords=cars&view=grid 

I would prefer to keep the relative URL path. With that said, for a relative URL with all parameters, what is the difference between request.original_fullpath and request.fullpath ? Seems to be the same thing?

request.original_fullpath

 /search?utf8=%E2%9C%93&keywords=cars&view=grid 

request.fullpath

 /search?utf8=%E2%9C%93&keywords=cars&view=grid 
+6
source share
1 answer

original_fullpath returns a String with the last path requested, including their parameters.

fullpath returns the full path of the String, including the parameters of the last requested URL.

The difference between original_fullpath and fullpath is that the original_fullpath method does not include the parameters that were in the original url (that is, the parameters that were sent via POST instead of GET).

+8
source

All Articles