Automatically add parent model id in nested resources
问题 With nested resource routes in Rails 3, such as the following: resources :magazines do resources :ads end helpers such as magazine_ad_path are defined, to which I have to pass both a magazine and the ad, which is inconvenient if I just have a reference to the ad: magazine_ad_path(@ad.magazine, @ad) Is there a nice way to set up an ad_path helper that takes the @ad and returns the appropriate address including the magazine ID? (This would also then allow the use of link_to @ad , redirect_to