aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index e8dd54b3f0..528bcd4189 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -293,11 +293,13 @@ module ActionDispatch
raise ArgumentError, message
end
- if controller.is_a?(String) && controller =~ %r{\A/}
+ return unless controller
+
+ if controller =~ %r{\A/}
raise ArgumentError, "controller name should not start with a slash"
end
- if controller.is_a?(String) && controller !~ /\A[a-z_0-9\/]*\z/
+ if controller !~ /\A[a-z_0-9\/]*\z/
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