I am using nested routes and I want to provide some kind of quick access method. (I am using RoR 3.0)
The routes are as follows.
resources :countries do
resources :regions do
resources :wineries
end
end
In order to access the route of the winery, I want to be able to define a function that eliminates the need to specify a country and region each time. How:
def winery_path(winery)
country_region_winery_path (winery.country, winery.region, winery)
end
Where should I do this? How can I get this if url_for is available?
source
share