Skip to content

Commit

Permalink
Fix named routes for member actions of singleton resources [#4266 sta…
Browse files Browse the repository at this point in the history
…te:resolved]

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information
pixeltrix authored and wycats committed Mar 27, 2010
1 parent 3a875e6 commit 39c35ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -479,7 +479,7 @@ def resource(*resources, &block)
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

Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/dispatch/routing_test.rb
Expand Up @@ -25,6 +25,7 @@ def self.matches?(request)

resource :session do
get :create
post :reset

resource :info
end
Expand Down Expand Up @@ -247,6 +248,10 @@ def test_session_singleton_resource
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

Expand Down

0 comments on commit 39c35ff

Please sign in to comment.