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