diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-10 05:26:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-10 05:26:55 +0000 |
commit | 14e7c7c21dcffd8f4388883eb241e0cc0ad23bbc (patch) | |
tree | f80064d5883fff3be1461b2ce9a568e2d48807d2 /actionpack/lib/action_controller | |
parent | 383b6afd1c943096951ea845b3fc726f4d2193a6 (diff) | |
download | rails-14e7c7c21dcffd8f4388883eb241e0cc0ad23bbc.tar.gz rails-14e7c7c21dcffd8f4388883eb241e0cc0ad23bbc.tar.bz2 rails-14e7c7c21dcffd8f4388883eb241e0cc0ad23bbc.zip |
Better documentation for Calling multiple redirects or renders #1687 [courtenay]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1795 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 7b30b3d6f1..873684cfaa 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -184,16 +184,19 @@ module ActionController #:nodoc: # # == Calling multiple redirects or renders # - # The rule for handling calls of multiple redirects and renders is that the first call wins. So in the following example: + # An action should conclude by a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError: # # def do_something # redirect_to :action => "elsewhere" - # render :action => "overthere" + # render :action => "overthere" # raises DoubleRenderError # end # - # Only the redirect happens. The rendering call is simply ignored. + # If you need to redirect on the condition of something, then be sure to add "and return" to halt execution. # - # == Environments + # def do_something + # redirect_to(:action => "elsewhere") and return if monkeys.nil? + # render :action => "overthere" # won't be called unless monkeys is nil + # end # == Environments # # Action Controller works out of the box with CGI, FastCGI, and mod_ruby. CGI and mod_ruby controllers are triggered just the same using: # |