Reputation: 1784
Is it possible(Sorry about the content but it's pretty much what I wanna ask)
Upvotes: 1
Views: 492
Reputation: 47548
If you're willing to trust the browser, you could just do:
redirect_to request.referrer
But if web development has taught us anything, it is that you shouldn't trust the browser to do anything but crash occasionally, and to fail to render pages as you expected.
If the previous page is served by your application, you could capture it in the session hash and pull the stored path back out when you need to redirect. There's a good example of this technique in this Authlogic demo app.
Upvotes: 3