aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-03-25 13:25:56 +0000
committerwycats <wycats@gmail.com>2010-03-27 00:49:47 -0700
commit39c35ff04b4478968b8994bc5fad74f5840eb64c (patch)
treeb754987b585e57da1dad8f6774eb8648da96481b /actionpack
parent3a875e618487a06a56f6cf912cf5440f294921cc (diff)
downloadrails-39c35ff04b4478968b8994bc5fad74f5840eb64c.tar.gz
rails-39c35ff04b4478968b8994bc5fad74f5840eb64c.tar.bz2
rails-39c35ff04b4478968b8994bc5fad74f5840eb64c.zip
Fix named routes for member actions of singleton resources [#4266 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index cc3ed169d8..5a3868e1d4 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -479,7 +479,7 @@ module ActionDispatch
scope(:path => resource.name.to_s, :controller => resource.controller) do
with_scope_level(:resource, resource) do
- scope(:name_prefix => resource.name.to_s) do
+ scope(:name_prefix => resource.name.to_s, :as => "") do
yield if block_given?
end
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index cbe9b5488c..c4e71a8689 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -25,6 +25,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
resource :session do
get :create
+ post :reset
resource :info
end
@@ -247,6 +248,10 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get '/session/edit'
assert_equal 'sessions#edit', @response.body
assert_equal '/session/edit', edit_session_path
+
+ post '/session/reset'
+ assert_equal 'sessions#reset', @response.body
+ assert_equal '/session/reset', reset_session_path
end
end