diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index c118c72440199..93ed6a8737989 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -511,7 +511,7 @@ def member_name # Checks for uncountable plurals, and appends "_index" if they're. def collection_name - singular == plural ? "#{plural}_index" : plural + singular == plural ? "#{name}_index" : name end def resource_scope diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 3f090b72540ba..55235b6e9e2f5 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -188,6 +188,7 @@ def self.matches?(request) end resources :sheep + resources :taxis resources :clients do namespace :google do @@ -965,6 +966,14 @@ def test_resources_for_uncountable_names assert_equal '/sheep/1/edit', edit_sheep_path(1) end end + + def test_named_paths_for_resources_with_irregular_plural_of_the_plural + with_test_routes do + assert_equal '/taxis/1', taxi_path(1) + assert_equal '/taxis', taxis_path + assert_raise(NameError) { taxes_path } + end + end def test_path_names with_test_routes do