Forum: Ruby on Rails resource routes where singular and plural are the same

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Parker T. (Guest)
on 2007-06-03 22:41
(Received via mailing list)
I have a question regarding routes for resources that have the same
name in the singular and plural.  For example, if I have:

  map.resources :series do |series|
     series.resources :characters

then 'new_series_url' generates '/series/new', however I get the
following error when I hit that url:

series_url failed to generate from {:action=>"show",
:controller=>"series"} - you may have ambiguous routes, or you may
need to supply additional parameters for this route.  content_url has
the following required parameters: ["series", :id] - are they all

I'm presuming here it assumes I want the url for an existing series.
I am able to create series if I use a singleton resource, e.g.:

  map.resources :series

however, this fouls up the nesting of my characters resource causing
'new_character_url(:series_id => @series)'  to generate the following


which makes some sense, as I've now said series is a singleton
resource.  So, my question is how do I disambiguate between series
(plural) and series (singular) when using non-singleton resources and
generated url helpers to get properly nested resources?


Trevor S. (Guest)
on 2007-06-04 06:27
(Received via mailing list)

I explain how here:


On 6/3/07, Parker T. <removed_email_address@domain.invalid> wrote:
> Thanks,
> pt.
> >

Trevor S.
This topic is locked and can not be replied to.