From 630638b00e01d4046d439867a37c15cd037f6c00 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 27 Feb 2005 17:12:35 +0000 Subject: Fixed that Routes would raise NameErrors if a controller component contains characters that are not valid constant names #733 [Nicholas Seckar] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@803 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/routing.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index d270defa4d..ab568b6595 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -134,6 +134,7 @@ module ActionController def eat_path_to_controller(path) path.inject([Controllers, 1]) do |(mod, length), name| name = name.camelize + return nil, nil unless /^[A-Z][_a-zA-Z\d]*$/ =~ name controller_name = name + "Controller" return mod.const_get(controller_name), path[length..-1] if mod.const_available? controller_name return nil, nil unless mod.const_available? name -- cgit v1.2.3