(Copied from my stagnant SO post: http://stackoverflow.com/q/5462652/49485.
Feel free to answer there and get reputation if you like.)

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 @ad`,
etc., which automatically call the `ad_path` helper corresponding to
the model class.)

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to