Skip to content

Commit 8dc7a7f

Browse files
authored
Merge pull request rails#51975 from artfuldodger/patch-1
Clarify and make double rendering documentation consistent [ci skip]
2 parents 67c7c91 + 625ec83 commit 8dc7a7f

File tree

1 file changed

+7
-4
lines changed
  • actionpack/lib/action_controller

1 file changed

+7
-4
lines changed

actionpack/lib/action_controller/base.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,22 @@ module ActionController
185185
#
186186
# ## Calling multiple redirects or renders
187187
#
188-
# An action may contain only a single render or a single redirect. Attempting to
189-
# try to do either again will result in a DoubleRenderError:
188+
# An action may perform only a single render or a single redirect. Attempting to
189+
# do either again will result in a DoubleRenderError:
190190
#
191191
# def do_something
192192
# redirect_to action: "elsewhere"
193193
# render action: "overthere" # raises DoubleRenderError
194194
# end
195195
#
196196
# If you need to redirect on the condition of something, then be sure to add
197-
# "and return" to halt execution.
197+
# "return" to halt execution.
198198
#
199199
# def do_something
200-
# redirect_to(action: "elsewhere") and return if monkeys.nil?
200+
# if monkeys.nil?
201+
# redirect_to(action: "elsewhere")
202+
# return
203+
# end
201204
# render action: "overthere" # won't be called if monkeys is nil
202205
# end
203206
#

0 commit comments

Comments
 (0)