diff options
author | ChakreshwarSharma <chakreshwar.sharma@yahoo.com> | 2017-03-02 20:10:18 +0530 |
---|---|---|
committer | ChakreshwarSharma <chakreshwar.sharma@yahoo.com> | 2017-03-04 13:34:22 +0530 |
commit | 51068a71fc7cf9706653ad3184be46c2ef7dfcbb (patch) | |
tree | 3af365d20dc1b813b13bc8658427bc61fbba6e7f /actionpack | |
parent | f294e649b7e659d36744e3af0c462d80728e5f41 (diff) | |
download | rails-51068a71fc7cf9706653ad3184be46c2ef7dfcbb.tar.gz rails-51068a71fc7cf9706653ad3184be46c2ef7dfcbb.tar.bz2 rails-51068a71fc7cf9706653ad3184be46c2ef7dfcbb.zip |
[ci skip] Use return with redirect_to
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/redirecting.rb | 3 |
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 |