aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2017-03-05 19:53:31 +0530
committerGitHub <noreply@github.com>2017-03-05 19:53:31 +0530
commit6ef074a3b25526bd31fe3415bb39698fa94d4374 (patch)
treee65b7f26036f700a8a2cec4cd10f75d009352c29
parentc21f71c7ef5682be89d94d58bc950e6412850c5d (diff)
parent51068a71fc7cf9706653ad3184be46c2ef7dfcbb (diff)
downloadrails-6ef074a3b25526bd31fe3415bb39698fa94d4374.tar.gz
rails-6ef074a3b25526bd31fe3415bb39698fa94d4374.tar.bz2
rails-6ef074a3b25526bd31fe3415bb39698fa94d4374.zip
Merge pull request #28259 from ChakreshwarSharma/redirect_to_doc
[ci skip] Use return with redirect_to
-rw-r--r--actionpack/lib/action_controller/metal/redirecting.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb
index a349841082..a3159c29dd 100644
--- a/actionpack/lib/action_controller/metal/redirecting.rb
+++ b/actionpack/lib/action_controller/metal/redirecting.rb
@@ -50,6 +50,9 @@ module ActionController
# redirect_to post_url(@post), status: 301, flash: { updated_post_id: @post.id }
# redirect_to({ action: 'atom' }, alert: "Something serious happened")
#
+ # Statements after redirect_to in our controller get executed, so redirect_to doesn't stop the execution of the function.
+ 
# To terminate the execution of the function immediately after the redirect_to, use return.
+ # redirect_to post_url(@post) and return
def redirect_to(options = {}, response_status = {})
raise ActionControllerError.new("Cannot redirect to nil!") unless options
raise AbstractController::DoubleRenderError if response_body