Adding linkage to redirect_to from Base and adding status code option reference

This commit is contained in:
Mikel Lindsaar 2010-09-09 13:37:21 +10:00
parent 03377c755f
commit 1a8d77d825
2 changed files with 6 additions and 2 deletions

@ -148,6 +148,8 @@ module ActionController
# #
# In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method which is then executed. # In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method which is then executed.
# #
# Learn more about <tt>redirect_to</tt> and what options you have in ActionController::Redirecting.
#
# == Calling multiple redirects or renders # == Calling multiple redirects or renders
# #
# An action may contain only a single render or a single redirect. Attempting to try to do either again will result in a DoubleRenderError: # An action may contain only a single render or a single redirect. Attempting to try to do either again will result in a DoubleRenderError:

@ -38,6 +38,9 @@ module Redirecting
# redirect_to :action=>'atom', :status => :moved_permanently # redirect_to :action=>'atom', :status => :moved_permanently
# redirect_to post_url(@post), :status => 301 # redirect_to post_url(@post), :status => 301
# redirect_to :action=>'atom', :status => 302 # redirect_to :action=>'atom', :status => 302
#
# The status code can either be a standard {HTTP Status code}[http://www.iana.org/assignments/http-status-codes] as an
# integer, or a symbol representing the downcased, underscored and symbolized description.
# #
# It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names # It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names
# +alert+ and +notice+ as well as a general purpose +flash+ bucket. # +alert+ and +notice+ as well as a general purpose +flash+ bucket.
@ -48,8 +51,7 @@ module Redirecting
# redirect_to post_url(@post), :status => 301, :flash => { :updated_post_id => @post.id } # redirect_to post_url(@post), :status => 301, :flash => { :updated_post_id => @post.id }
# redirect_to { :action=>'atom' }, :alert => "Something serious happened" # redirect_to { :action=>'atom' }, :alert => "Something serious happened"
# #
# When using <tt>redirect_to :back</tt>, if there is no referrer, # When using <tt>redirect_to :back</tt>, if there is no referrer, RedirectBackError will be raised. You may specify some fallback
# RedirectBackError will be raised. You may specify some fallback
# behavior for this case by rescuing RedirectBackError. # behavior for this case by rescuing RedirectBackError.
def redirect_to(options = {}, response_status = {}) #:doc: def redirect_to(options = {}, response_status = {}) #:doc:
raise ActionControllerError.new("Cannot redirect to nil!") if options.nil? raise ActionControllerError.new("Cannot redirect to nil!") if options.nil?