Skip to content

Commit

Permalink
Accept Symbol for contoller name [#2855 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
  • Loading branch information
Yehuda Katz + Carl Lerche committed Jul 1, 2009
1 parent eb52dc3 commit e10305f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/routing/route_set.rb
Expand Up @@ -436,7 +436,7 @@ def call(env)
def recognize(request)
params = recognize_path(request.path, extract_request_environment(request))
request.path_parameters = params.with_indifferent_access
"#{params[:controller].camelize}Controller".constantize
"#{params[:controller].to_s.camelize}Controller".constantize
end

def recognize_path(path, environment={})
Expand Down
11 changes: 11 additions & 0 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -1662,6 +1662,17 @@ def test_draw
assert_equal 1, set.routes.size
end

def test_draw_symbol_controller_name
assert_equal 0, set.routes.size
set.draw do |map|
map.connect '/users/index', :controller => :users, :action => :index
end
@request = ActionController::TestRequest.new
@request.request_uri = '/users/index'
assert_nothing_raised { set.recognize(@request) }
assert_equal 1, set.routes.size
end

def test_named_draw
assert_equal 0, set.routes.size
set.draw do |map|
Expand Down

0 comments on commit e10305f

Please sign in to comment.