File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
lib/action_dispatch/routing Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -425,10 +425,11 @@ def member_name
425
425
singular
426
426
end
427
427
428
+ # Checks for uncountable plurals, and appends "_index" if they're.
428
429
def collection_name
429
430
uncountable? ? "#{ plural } _index" : plural
430
431
end
431
-
432
+
432
433
def uncountable?
433
434
singular == plural
434
435
end
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ def self.matches?(request)
113
113
resources :posts , :only => [ :index , :show ] do
114
114
resources :comments , :except => :destroy
115
115
end
116
-
116
+
117
117
resources :sheep
118
118
119
119
match 'sprockets.js' => ::TestRoutingMapper ::SprocketsApp
@@ -532,11 +532,13 @@ def test_resource_routes_with_only_and_except
532
532
assert_raise ( ActionController ::RoutingError ) { delete '/posts/1/comments' }
533
533
end
534
534
end
535
-
535
+
536
536
def test_resources_for_uncountable_names
537
537
with_test_routes do
538
538
assert_equal '/sheep' , sheep_index_path
539
539
assert_equal '/sheep/1' , sheep_path ( 1 )
540
+ assert_equal '/sheep/new' , new_sheep_path
541
+ assert_equal '/sheep/1/edit' , edit_sheep_path ( 1 )
540
542
end
541
543
end
542
544
You can’t perform that action at this time.
0 commit comments