module ActionController::Redirecting
def redirect_back(fallback_location:, **args)
All options that can be passed to redirect_to are accepted as
redirect_back fallback_location: proc { edit_post_url(@post) }
redirect_back fallback_location: articles_url
redirect_back fallback_location: "/images/screenshot.jpg"
redirect_back fallback_location: "http://www.rubyonrails.org"
redirect_back fallback_location: post
redirect_back fallback_location: { action: "show", id: 5 }
is missing this header, the fallback_location will be used.
subject to browser security settings and user preferences. If the request
the request. This is an optional header and its presence on the request is
The referrer information is pulled from the HTTP `Referer` (sic) header on
location.
if possible, otherwise redirects to the provided default fallback
Redirects the browser to the page that issued the request (the referrer)
def redirect_back(fallback_location:, **args) if referer = request.headers["Referer"] redirect_to referer, **args else redirect_to fallback_location, **args end end