diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-09-06 23:45:34 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-09-06 23:45:34 +0530 |
commit | b4dac34508dfa492da69be25321c8f31d5f77b8f (patch) | |
tree | c032030df5c3f0483961f5029e0fa3d750737b56 /guides | |
parent | c683ac4fe0313e346d10f2522b0db312ec470715 (diff) | |
download | rails-b4dac34508dfa492da69be25321c8f31d5f77b8f.tar.gz rails-b4dac34508dfa492da69be25321c8f31d5f77b8f.tar.bz2 rails-b4dac34508dfa492da69be25321c8f31d5f77b8f.zip |
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]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/layouts_and_rendering.md | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 2722789c49..efd5b4638e 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -630,6 +630,8 @@ to use in this case. 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 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: |