Merge pull request #51975 from artfuldodger/patch-1

Clarify and make double rendering documentation consistent [ci skip]
This commit is contained in:
Rafael Mendonça França 2024-05-31 17:42:39 -04:00 committed by GitHub
commit 8dc7a7fb15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -185,8 +185,8 @@ module ActionController
# #
# ## Calling multiple redirects or renders # ## Calling multiple redirects or renders
# #
# An action may contain only a single render or a single redirect. Attempting to # An action may perform only a single render or a single redirect. Attempting to
# try to do either again will result in a DoubleRenderError: # do either again will result in a DoubleRenderError:
# #
# def do_something # def do_something
# redirect_to action: "elsewhere" # redirect_to action: "elsewhere"
@ -194,10 +194,13 @@ module ActionController
# end # end
# #
# If you need to redirect on the condition of something, then be sure to add # If you need to redirect on the condition of something, then be sure to add
# "and return" to halt execution. # "return" to halt execution.
# #
# def do_something # def do_something
# redirect_to(action: "elsewhere") and return if monkeys.nil? # if monkeys.nil?
# redirect_to(action: "elsewhere")
# return
# end
# render action: "overthere" # won't be called if monkeys is nil # render action: "overthere" # won't be called if monkeys is nil
# end # end
# #