Resource routes where singular and plural are the same

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
end

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
satisifed?

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
url:

http://localhost:3000/series/characters/new?series_id=16

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?

Thanks,

pt.

Hey,

I explain how here:

http://somethinglearned.com/articles/2007/03/19/how-to-uncountable-names-in-restful-routes

HTH,
Trevor

On 6/3/07, Parker T. [email protected] wrote:

Thanks,

pt.

Trevor S.
http://somethinglearned.com