Skip to content
Browse files

Allow actions which start with A-Za-z_ only

  • Loading branch information...
1 parent 3519d61 commit 4df19b3f27c93e0a3091c176536fa119ea03ebb7 @spastorino spastorino committed Aug 24, 2010
Showing with 5 additions and 2 deletions.
  1. +1 −1 actionpack/lib/action_dispatch/routing/mapper.rb
  2. +4 −1 actionpack/test/dispatch/routing_test.rb
View
2 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])
View
5 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

0 comments on commit 4df19b3

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