I have a number of resources that I want to access in various scopes.
The index action would change slightly depending on its scope, but the
rest of the actions would be identical aside from needing to preserve
the url scope in links and redirects.
map.resources :categories do |categories|
categories.resources :products do |products|
map.resources :products do |products|
This enables the following routes all to work:
However, if I understand correctly, I have to specify which route in the
I’d like to be able to use components_path and have it be smart enough
based on the options and params to preserve as much scoped routing as
possible. For example:
Calling components_path in /categories/1/products/1 ->
Calling components_path in /products/1 -> /products/1/components
Calling components_path somewhere else -> /components
Is there any way to do this?