aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-08-24 12:43:43 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-24 12:43:43 -0300
commit4df19b3f27c93e0a3091c176536fa119ea03ebb7 (patch)
treec2917357dbb59b42dfaa4d9789d94a01be317358
parent3519d61af9f6230354e6c09e4078d7fa0ddf1763 (diff)
downloadrails-4df19b3f27c93e0a3091c176536fa119ea03ebb7.tar.gz
rails-4df19b3f27c93e0a3091c176536fa119ea03ebb7.tar.bz2
rails-4df19b3f27c93e0a3091c176536fa119ea03ebb7.zip
Allow actions which start with A-Za-z_ only
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb5
2 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 0c77183dc1..76c7ec35b9 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -726,7 +726,7 @@ module ActionDispatch
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 a84c4d2d18..3f51798285 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -188,7 +188,9 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- resources :sheep
+ resources :sheep do
+ get "_it", :on => :member
+ end
resources :clients do
namespace :google do
@@ -996,6 +998,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
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