diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 528bcd4189939957944b1bfe2f086a518b488f30..b8aadff5e68a3057e2994b4eeba1c1a3bc4eb24c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -294,16 +294,16 @@ def check_controller!(controller) end return unless controller + return if controller =~ /\A[a-z_0-9][a-z_0-9\/]*\z/ if controller =~ %r{\A/} - raise ArgumentError, "controller name should not start with a slash" - end - - if controller !~ /\A[a-z_0-9\/]*\z/ + message = "controller name should not start with a slash" + else message = "'#{controller}' is not a supported controller name. This can lead to potential routing problems." message << " See http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use" - raise ArgumentError, message end + + raise ArgumentError, message end def blocks