diff options
author | Jan De Poorter <jan@defv.be> | 2010-02-25 16:21:41 +0100 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-28 18:34:48 -0700 |
commit | 72074aac334a846fbb53e7cb12c0254c15004c26 (patch) | |
tree | 70841578599e08c00289112dc5671532a3d71a6f /actionpack/lib/action_dispatch | |
parent | 4b07352420c4a3c0fdae40fd6fd31796f39a8909 (diff) | |
download | rails-72074aac334a846fbb53e7cb12c0254c15004c26.tar.gz rails-72074aac334a846fbb53e7cb12c0254c15004c26.tar.bz2 rails-72074aac334a846fbb53e7cb12c0254c15004c26.zip |
Add _index to named collection routes for uncountable resources (e.g. Sheep)
Signed-off-by: Rizwan Reza <rizwanreza@gmail.com>
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 2546bdd43e..fa64a2f1d0 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -426,7 +426,11 @@ module ActionDispatch end def collection_name - plural + uncountable? ? "#{plural}_index" : plural + end + + def uncountable? + singular == plural end def name_for_action(action) |