diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0c77183dc12e6faf65809e3d0d9a42c999a024f6..76c7ec35b9f917c8c3a578037cd5993a795b4160 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -726,7 +726,7 @@ def match(*args) path = options.delete(:path) action = args.first - if action && action.to_s =~ /^[\w_]+$/ + if action && action.to_s =~ /^[A-Za-z_]\w*$/ path = path_for_action(action, path) options[:action] ||= action options[:as] = name_for_action(action, options[:as]) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index a84c4d2d1806c4509f30aa5a693d536c87fb940d..3f51798285d32d01cf3828fcee2df602762c5c5e 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -188,7 +188,9 @@ def self.matches?(request) end end - resources :sheep + resources :sheep do + get "_it", :on => :member + end resources :clients do namespace :google do @@ -996,6 +998,7 @@ def test_resources_for_uncountable_names assert_equal '/sheep/1', sheep_path(1) assert_equal '/sheep/new', new_sheep_path assert_equal '/sheep/1/edit', edit_sheep_path(1) + assert_equal '/sheep/1/_it', _it_sheep_path(1) end end