I have an application where the user selects the product they wish to view.
- View index of products and select one
- The products show action is called and show.html.erb is viewed. url => /products/3
Now if the user clicks the index of the products they are again shown all the products. But I want them to be able to easily return to the product they were viewing.
The url for the products index: /products
I can’t add the product id because this won’t show the index page: /products/3
will go to the show page for product with id 3
Is there a good way to keep this information neatly in the url without doing something ugly like:
/products?product_id=3
How about storing that data in the session?