Skip to content
This repository
Browse code

Accept Symbol for contoller name [#2855 state:resolved]

Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
  • Loading branch information...
commit e10305f0f4f3dc6e9f9377ac5cf68e70b6af8474 1 parent eb52dc3
authored July 01, 2009
2  actionpack/lib/action_controller/routing/route_set.rb
@@ -436,7 +436,7 @@ def call(env)
436 436
       def recognize(request)
437 437
         params = recognize_path(request.path, extract_request_environment(request))
438 438
         request.path_parameters = params.with_indifferent_access
439  
-        "#{params[:controller].camelize}Controller".constantize
  439
+        "#{params[:controller].to_s.camelize}Controller".constantize
440 440
       end
441 441
 
442 442
       def recognize_path(path, environment={})
11  actionpack/test/controller/routing_test.rb
@@ -1662,6 +1662,17 @@ def test_draw
1662 1662
     assert_equal 1, set.routes.size
1663 1663
   end
1664 1664
 
  1665
+  def test_draw_symbol_controller_name
  1666
+    assert_equal 0, set.routes.size
  1667
+    set.draw do |map|
  1668
+      map.connect '/users/index', :controller => :users, :action => :index
  1669
+    end
  1670
+    @request = ActionController::TestRequest.new
  1671
+    @request.request_uri = '/users/index'
  1672
+    assert_nothing_raised { set.recognize(@request) }
  1673
+    assert_equal 1, set.routes.size
  1674
+  end
  1675
+
1665 1676
   def test_named_draw
1666 1677
     assert_equal 0, set.routes.size
1667 1678
     set.draw do |map|

0 notes on commit e10305f

Please sign in to comment.
Something went wrong with that request. Please try again.