diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-16 15:16:22 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-16 15:16:22 -0600 |
commit | e9a1dbe79a6610793a71af227aaf64ff55554cad (patch) | |
tree | 16f6c5fad6dbdea2807d1cd098b75ed1567747a9 /actionpack | |
parent | 468cfcedd311a428339fa01e5f62b935f2995ec0 (diff) | |
download | rails-e9a1dbe79a6610793a71af227aaf64ff55554cad.tar.gz rails-e9a1dbe79a6610793a71af227aaf64ff55554cad.tar.bz2 rails-e9a1dbe79a6610793a71af227aaf64ff55554cad.zip |
Allow custom controller for resource(s) [#3703 state:resolved]
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ce5c56ae1c..9aaa4355f2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -380,7 +380,7 @@ module ActionDispatch end def controller - plural + options[:controller] || plural end def member_name diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 5845c791a0..6dccabdb3f 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -65,7 +65,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :companies do resources :people - resource :avatar + resource :avatar, :controller => :avatar end resources :images do @@ -294,34 +294,34 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest def test_projects with_test_routes do get '/projects' - assert_equal 'projects#index', @response.body + assert_equal 'project#index', @response.body assert_equal '/projects', projects_path post '/projects' - assert_equal 'projects#create', @response.body + assert_equal 'project#create', @response.body get '/projects.xml' - assert_equal 'projects#index', @response.body + assert_equal 'project#index', @response.body assert_equal '/projects.xml', projects_path(:format => 'xml') get '/projects/new' - assert_equal 'projects#new', @response.body + assert_equal 'project#new', @response.body assert_equal '/projects/new', new_project_path get '/projects/new.xml' - assert_equal 'projects#new', @response.body + assert_equal 'project#new', @response.body assert_equal '/projects/new.xml', new_project_path(:format => 'xml') get '/projects/1' - assert_equal 'projects#show', @response.body + assert_equal 'project#show', @response.body assert_equal '/projects/1', project_path(:id => '1') get '/projects/1.xml' - assert_equal 'projects#show', @response.body + assert_equal 'project#show', @response.body assert_equal '/projects/1.xml', project_path(:id => '1', :format => 'xml') get '/projects/1/edit' - assert_equal 'projects#edit', @response.body + assert_equal 'project#edit', @response.body assert_equal '/projects/1/edit', edit_project_path(:id => '1') end end @@ -383,7 +383,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal '/projects/1/companies/1/people', project_company_people_path(:project_id => '1', :company_id => '1') get '/projects/1/companies/1/avatar' - assert_equal 'avatars#show', @response.body + assert_equal 'avatar#show', @response.body assert_equal '/projects/1/companies/1/avatar', project_company_avatar_path(:project_id => '1', :company_id => '1') end end |