Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8634

Show
Ignore:
Timestamp:
01/12/08 03:10:38 (4 months ago)
Author:
nzkoz
Message:

Merge the fix for redirecting to nil. References #10272 [farleyknight]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2-0-stable/actionpack/lib/action_controller/base.rb

    r8585 r8634  
    10301030      # behavior for this case by rescuing RedirectBackError. 
    10311031      def redirect_to(options = {}, response_status = {}) #:doc:  
    1032          
     1032        raise ActionControllerError.new("Cannot redirect to nil!") if options.nil? 
     1033 
    10331034        if options.is_a?(Hash) && options[:status]  
    10341035          status = options.delete(:status)  
  • branches/2-0-stable/actionpack/test/controller/redirect_test.rb

    r7934 r8634  
    7676  def redirect_to_new_record 
    7777    redirect_to Workshop.new(5, true) 
     78  end 
     79 
     80  def redirect_to_nil 
     81    redirect_to nil 
    7882  end 
    7983 
     
    216220    assert_equal "http://test.host/workshops", redirect_to_url 
    217221  end 
     222 
     223  def test_redirect_to_nil 
     224    assert_raises(ActionController::ActionControllerError) do 
     225      get :redirect_to_nil 
     226    end 
     227  end 
     228 
    218229end 
    219230