Skip to content
Browse files

the `:controller` option for routes can contain numbers. closes #9231.

  • Loading branch information...
1 parent 9c5cc89 commit 9e10d591991e8e52488880f5c0d518590716d225 @senny senny committed Feb 9, 2013
Showing with 13 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_dispatch/routing/mapper.rb
  2. +12 −0 actionpack/test/dispatch/routing_test.rb
View
2 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -246,7 +246,7 @@ def default_controller_and_action(to_shorthand=nil)
raise ArgumentError, "missing :action"
end
- if controller.is_a?(String) && controller !~ /\A[a-z_\/]+\z/
+ 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"
raise ArgumentError, message
View
12 actionpack/test/dispatch/routing_test.rb
@@ -1031,6 +1031,18 @@ def test_namespace_with_options
assert_equal 'users/home#index', @response.body
end
+ def test_namespace_containing_numbers
+ draw do
+ namespace :v2 do
+ resources :subscriptions
+ end
+ end
+
+ get '/v2/subscriptions'
+ assert_equal 'v2/subscriptions#index', @response.body
+ assert_equal '/v2/subscriptions', v2_subscriptions_path
+ end
+
def test_articles_with_id
draw do
controller :articles do

0 comments on commit 9e10d59

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