redirect_back_or_to
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0 (0)
- 7.1.3.2 (38)
- 7.1.3.4 (0)
- What's this?
redirect_back_or_to(fallback_location, allow_other_host: _allow_other_host, **options)
public
Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.
The referrer information is pulled from the HTTP Referer (sic) header on the request. This is an optional header and its presence on the request is subject to browser security settings and user preferences. If the request is missing this header, the fallback_location will be used.
redirect_back_or_to({ action: "show", id: 5 }) redirect_back_or_to @post redirect_back_or_to "http://www.rubyonrails.org" redirect_back_or_to "/images/screenshot.jpg" redirect_back_or_to posts_url redirect_back_or_to proc { edit_post_url(@post) } redirect_back_or_to '/', allow_other_host: false
Options
-
:allow_other_host - Allow or disallow redirection to the host that is different to the current host, defaults to true.
All other options that can be passed to #redirect_to are accepted as options and the behavior is identical.