Let’s say I have a RoR app with 3 pages.
The user can get to page 3 via a button on page 1 or page 2.
On page 3, how can I track where they came from – so I can send them back to that page?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think there are three solutions.
First, store the previous page url in the session. See: How to save http referer in rails
Second, store the url in
paramsof get request. For example, the button will on page 1 look like this:link_to "page 3", "/page3", :ref => "page1"And third, use http referer already answered by @johnernaut