I’ve got this on routes.rb
resources :items do
resources :requisitos
resources :videos
end
and that generates:
GET /items/:item_id/requisitos(.:format) requisitos#index
POST /items/:item_id/requisitos(.:format) requisitos#create
GET /items/:item_id/requisitos/new(.:format) requisitos#new
GET /items/:item_id/requisitos/:id/edit(.:format) requisitos#edit
GET /items/:item_id/requisitos/:id(.:format) requisitos#show
PUT /items/:item_id/requisitos/:id(.:format) requisitos#update
DELETE /items/:item_id/requisitos/:id(.:format) requisitos#destroy
GET /items/:item_id/videos(.:format) videos#index
POST /items/:item_id/videos(.:format) videos#create
GET /items/:item_id/videos/new(.:format) videos#new
GET /items/:item_id/videos/:id/edit(.:format) videos#edit
GET /items/:item_id/videos/:id(.:format) videos#show
PUT /items/:item_id/videos/:id(.:format) videos#update
DELETE /items/:item_id/videos/:id(.:format) videos#destroy
GET /items(.:format) items#index
POST /items(.:format) items#create
GET /items/new(.:format) items#new
GET /items/:id/edit(.:format) items#edit
GET /items/:id(.:format) items#show
PUT /items/:id(.:format) items#update
DELETE /items/:id(.:format)
Now, I wanted to change /items to /admin in all routes, how can I do this using recources in this nested resource?
You can set the path on your resources like so