Skip to content
Browse files

trade 2 is_a? checks for a nil check

  • Loading branch information...
1 parent 60ae505 commit 996e9f568cba400cf82ececbc69ea797b863644b @tenderlove tenderlove committed May 28, 2014
Showing with 4 additions and 2 deletions.
  1. +4 −2 actionpack/lib/action_dispatch/routing/mapper.rb
View
6 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -293,11 +293,13 @@ def check_controller!(controller)
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

0 comments on commit 996e9f5

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