I have a listing page, then a form, then a thank you page. I need to put a link on the thank you page that takes the user back to the page they were on before the form which always varies. I've tried using this:
= link_to "Back", :back
But this only takes them back to the previous page, so the form.
Try this
<%= link_to 'Back', url_for(:back) %>
# if request.env["HTTP_REFERER"] is set to "http://www.example.com"
# => http://www.example.com