Reputation: 5619
I want to redirect to page from where I come is that possible?
What I do:
Calling a controller function from an view, and when action is finished I want to render the same page like a back function?
Thanks
Upvotes: 2
Views: 4729
Reputation: 3103
If what you want is actually render (not redirect) to the last rendered view you can do it in the following way:
render request.referer.split('/').last
It guesses the last rendered view from the request HTTP referer (the URL from which the controller action has been called). Note this approach it's quite fragile, but can be handy in most cases.
Upvotes: 1
Reputation: 3255
Use
redirect_to :back
You can also pass more params to it. Read more here: http://api.rubyonrails.org/classes/ActionController/Redirecting.html
Upvotes: 3