Skip to content
This repository
Browse code

Allow custom controller for resource(s) [#3703 state:resolved]

  • Loading branch information...
commit e9a1dbe79a6610793a71af227aaf64ff55554cad 1 parent 468cfce
Joshua Peek josh authored
2  actionpack/lib/action_dispatch/routing/mapper.rb
@@ -380,7 +380,7 @@ def name
380 380 end
381 381
382 382 def controller
383   - plural
  383 + options[:controller] || plural
384 384 end
385 385
386 386 def member_name
20 actionpack/test/dispatch/routing_test.rb
@@ -65,7 +65,7 @@ def self.matches?(request)
65 65
66 66 resources :companies do
67 67 resources :people
68   - resource :avatar
  68 + resource :avatar, :controller => :avatar
69 69 end
70 70
71 71 resources :images do
@@ -294,34 +294,34 @@ def test_global
294 294 def test_projects
295 295 with_test_routes do
296 296 get '/projects'
297   - assert_equal 'projects#index', @response.body
  297 + assert_equal 'project#index', @response.body
298 298 assert_equal '/projects', projects_path
299 299
300 300 post '/projects'
301   - assert_equal 'projects#create', @response.body
  301 + assert_equal 'project#create', @response.body
302 302
303 303 get '/projects.xml'
304   - assert_equal 'projects#index', @response.body
  304 + assert_equal 'project#index', @response.body
305 305 assert_equal '/projects.xml', projects_path(:format => 'xml')
306 306
307 307 get '/projects/new'
308   - assert_equal 'projects#new', @response.body
  308 + assert_equal 'project#new', @response.body
309 309 assert_equal '/projects/new', new_project_path
310 310
311 311 get '/projects/new.xml'
312   - assert_equal 'projects#new', @response.body
  312 + assert_equal 'project#new', @response.body
313 313 assert_equal '/projects/new.xml', new_project_path(:format => 'xml')
314 314
315 315 get '/projects/1'
316   - assert_equal 'projects#show', @response.body
  316 + assert_equal 'project#show', @response.body
317 317 assert_equal '/projects/1', project_path(:id => '1')
318 318
319 319 get '/projects/1.xml'
320   - assert_equal 'projects#show', @response.body
  320 + assert_equal 'project#show', @response.body
321 321 assert_equal '/projects/1.xml', project_path(:id => '1', :format => 'xml')
322 322
323 323 get '/projects/1/edit'
324   - assert_equal 'projects#edit', @response.body
  324 + assert_equal 'project#edit', @response.body
325 325 assert_equal '/projects/1/edit', edit_project_path(:id => '1')
326 326 end
327 327 end
@@ -383,7 +383,7 @@ def test_projects_companies
383 383 assert_equal '/projects/1/companies/1/people', project_company_people_path(:project_id => '1', :company_id => '1')
384 384
385 385 get '/projects/1/companies/1/avatar'
386   - assert_equal 'avatars#show', @response.body
  386 + assert_equal 'avatar#show', @response.body
387 387 assert_equal '/projects/1/companies/1/avatar', project_company_avatar_path(:project_id => '1', :company_id => '1')
388 388 end
389 389 end

0 comments on commit e9a1dbe

Please sign in to comment.
Something went wrong with that request. Please try again.