Getting named parameters from routes.

I'm trying nested resources for a RESTful rails application.

So, I set my routes up like so:

map.resources :articles do |article|   article.resources :comments end

and when I "GET /articles/1", the 1 is assigned to params[:id] But when I "GET /articles/1/comments/2", the 1 is :article_id, and the 2 becomes :id. Which works just fine. Except that if I want before_filters to find the article and the comments, I need to have an almost identical, but not quite, find_article function in the articles and the comments function. One finds the article with param id, one with param article_id.

Is there some way I could change things so that everything was known by the 'full name' rather than the final parameter being shortened?

Jon

I have not used this yet, but I would look at the source for map.resources and see if there are options for controlling the name used for the id. It clearly generates different values for article based on whether there is a block present. You could always assign a block to the comments map resources with nothing in it and see if that forced it to comment_id.

Also, one of the people I talked with at RailsConf indicated that nested resources were broken in edge. Are you using edge or 1.2?

Michael