mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Document that redirect* don't halt exucution. We explain more on this behavior in 2.3.2, but dont specify that is not halting. Its better to not let developers be caught by surprise. [ci skip]
This commit is contained in:
parent
c683ac4fe0
commit
b4dac34508
1 changed files with 2 additions and 0 deletions
|
@ -630,6 +630,8 @@ to use in this case.
|
||||||
redirect_back(fallback_location: root_path)
|
redirect_back(fallback_location: root_path)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
NOTE: `redirect_to` and `redirect_back` do not halt and return immediately from method execution, but simply set HTTP responses. Statements occurring after them in a method will be executed. You need halt by an explicit `return` or some other halting mechanism, if needed.
|
||||||
|
|
||||||
#### Getting a Different Redirect Status Code
|
#### Getting a Different Redirect Status Code
|
||||||
|
|
||||||
Rails uses HTTP status code 302, a temporary redirect, when you call `redirect_to`. If you'd like to use a different status code, perhaps 301, a permanent redirect, you can use the `:status` option:
|
Rails uses HTTP status code 302, a temporary redirect, when you call `redirect_to`. If you'd like to use a different status code, perhaps 301, a permanent redirect, you can use the `:status` option:
|
||||||
|
|
Loading…
Reference in a new issue