GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/ddollar/rails.git
Backport fix to allow :controller=>:some_symbol [norbert]


git-svn-id: 
http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@7838 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
NZKoz (author)
Thu Oct 11 14:56:19 -0700 2007
commit  f70b74a5bc4b5dbd415cf42a4a16a7ded173765e
tree    15a9ce635624e0524c8d362bb30bc62fe303b16e
parent  88f2284b32b5cc302d2b37c0ad3c2667d4c58c6a
...
69
70
71
 
72
73
74
...
69
70
71
72
73
74
75
0
@@ -69,6 +69,7 @@ module ActionController
0
               end
0
 
0
               if value.respond_to?(:[]) && value['controller']
0
+ value['controller'] = value['controller'].to_s
0
                 if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/')
0
                   new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path)
0
                   value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path)
...
1254
1255
1256
 
 
 
1257
1258
1259
...
1254
1255
1256
1257
1258
1259
1260
1261
1262
0
@@ -1254,6 +1254,9 @@ module ActionController
0
         options = options_as_params(options)
0
         expire_on = build_expiry(options, recall)
0
 
0
+ if options[:controller]
0
+ options[:controller] = options[:controller].to_s
0
+ end
0
         # if the controller has changed, make sure it changes relative to the
0
         # current controller module, if any. In other words, if we're currently
0
         # on admin/get, and the new controller is 'set', the new controller
...
19
20
21
 
 
22
23
24
...
555
556
557
 
 
 
 
 
 
 
 
 
 
 
558
559
560
...
19
20
21
22
23
24
25
26
...
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
0
@@ -19,6 +19,8 @@ class ActionPackAssertionsController < ActionController::Base
0
 
0
   def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end
0
 
0
+ def redirect_to_controller_with_symbol() redirect_to :controller => :elsewhere, :action => :flash_me; end
0
+
0
   def redirect_to_path() redirect_to '/some/path' end
0
 
0
   def redirect_to_named_route() redirect_to route_one_url end
0
@@ -555,6 +557,17 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
0
     assert_redirected_to 'http://test.host/some/path'
0
   end
0
 
0
+ def test_assert_redirection_with_symbol
0
+ process :redirect_to_controller_with_symbol
0
+ assert_nothing_raised {
0
+ assert_redirected_to :controller => "elsewhere", :action => "flash_me"
0
+ }
0
+ process :redirect_to_controller_with_symbol
0
+ assert_nothing_raised {
0
+ assert_redirected_to :controller => :elsewhere, :action => :flash_me
0
+ }
0
+ end
0
+
0
   def test_redirected_to_with_nested_controller
0
     @controller = Admin::InnerModuleController.new
0
     get :redirect_to_absolute_controller
...
160
161
162
 
 
 
 
163
164
165
...
160
161
162
163
164
165
166
167
168
169
0
@@ -160,6 +160,10 @@ class UrlWriterTests < Test::Unit::TestCase
0
     assert_equal params[3], { 'query[person][position][]' => 'prof' }.to_query
0
   end
0
 
0
+ def test_path_generation_for_symbol_parameter_keys
0
+ assert_generates("/image", :controller=> :image)
0
+ end
0
+
0
   private
0
     def extract_params(url)
0
       url.split('?', 2).last.split('&')

Comments

    No one has commented yet.