I just started learning Ruby on Rails and working on a simple site that has the following setup:
resources :categories do
resources :products
end
resources :products do
resources :features
end
however I don't want to expose url to products_controller
/products(.:format) products#index
/products(.:format) products#create
/products/new(.:format) products#new
/products/:id/edit(.:format) products#edit
/products/:id(.:format) products#show
/products/:id(.:format) products#update
/products/:id(.:format) products#update
/products/:id(.:format) products#destroy
I just need routes that look like the following
/products/:product_id/features(.:format) features#index
/products/:product_id/features(.:format) features#create
/products/:product_id/features/new(.:format) features#new
/features/:id/edit(.:format) features#edit
/features/:id(.:format) features#show
/features/:id(.:format) features#update
/features/:id(.:format) features#update
/features/:id(.:format) features#destroy
I know the above routing can be done by marking shallow: true
, but it would still expose restful path to products_controller, is there anyway around this?