I have this routes
resources :posts, :controller => 'frontend/posts' do
resources :photos, :controller => 'frontend/posts'
end
So frontend/posts_controller handles these requests:
/posts/:post_id/photos/:id
/posts/:id
Somtimes the :id means the photo id and in some cases the post id.
I want that post always uses :post_id . Is it possible to rename :id in :post_id without adding custom(match …) routes?
thanks.
You should just write your finders to handle both cases. It’s easier than messing around with parameter names:
That being said, I agree that it’s annoying that the
:idparameter changes names depending on the depth of the resource call.