diff options
| -rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6b6e27ceb0..e8dd54b3f0 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -281,22 +281,22 @@ module ActionDispatch            end            def check_action!(action) -            if action.nil? && segment_keys.exclude?(:action) +            unless action || segment_keys.include?(:action)                message = "Missing :action key on routes definition, please check your routes."                raise ArgumentError, message              end            end            def check_controller!(controller) -            if controller.is_a?(String) && controller =~ %r{\A/} -              raise ArgumentError, "controller name should not start with a slash" -            end - -            if controller.nil? && segment_keys.exclude?(:controller) +            unless controller || segment_keys.include?(:controller)                message = "Missing :controller key on routes definition, please check your routes."                raise ArgumentError, message              end +            if controller.is_a?(String) && 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/                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"  | 
