diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-15 16:30:11 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-15 16:31:00 -0600 |
commit | b2578a148cb78b4f238ad92864c9d9e509e5e451 (patch) | |
tree | 9e666f3ff5d22b4f402ed474f94f36b814391b8b | |
parent | 2ee130abec222342c6f7ade3b651840dc89c1bcd (diff) | |
download | rails-b2578a148cb78b4f238ad92864c9d9e509e5e451.tar.gz rails-b2578a148cb78b4f238ad92864c9d9e509e5e451.tar.bz2 rails-b2578a148cb78b4f238ad92864c9d9e509e5e451.zip |
Fix singleton resource named routes
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 4 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 3 |
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 9b8660d22b..ce5c56ae1c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -448,8 +448,8 @@ module ActionDispatch post :create if resource.actions.include?(:create) put :update if resource.actions.include?(:update) delete :destroy if resource.actions.include?(:destroy) - get :new, :as => "new_#{resource.singular}" if resource.actions.include?(:new) - get :edit, :as => "edit_#{resource.singular}" if resource.actions.include?(:edit) + get :new, :as => resource.singular if resource.actions.include?(:new) + get :edit, :as => resource.singular if resource.actions.include?(:edit) end end diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 23581c8a17..890895a330 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -207,6 +207,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest with_test_routes do get '/session' assert_equal 'sessions#create', @response.body + assert_equal '/session', session_path post '/session' assert_equal 'sessions#create', @response.body @@ -219,9 +220,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest get '/session/new' assert_equal 'sessions#new', @response.body + assert_equal '/session/new', new_session_path get '/session/edit' assert_equal 'sessions#edit', @response.body + assert_equal '/session/edit', edit_session_path end end |