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
On May 21, 6:27 am, "Jonathan Stott"
<jonathan.st...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---