I use devise, and I want generate a new object scaffold under devise user sth like:
resources :users, :path => "/", :only => [:show] do
resources :collections, :controller => 'users/collections'
end
With above routes, I get this url:
http://localhost:3000/kevin_doe/collections
The problem is that if I issue this command:
rails g scaffold users/collection title:string description:text
This generate a namespace sth like:
namespace :users do resources :collections end
The route that I get is:
http://localhost:3000/users/collections
I want generate a scaffold under devise user resource.
How can I fix this problem?
Thank you!
The fix for this question are the next steps:
1º generate the scaffold with:
2º Modify your routes.rb file with the nested resource:
3º you must create a
"users" folderin your controllers directory and move thecollections_controller.rbto4º in
collections_controller.rbyou must modify:5º In your views you must move the folder
collectionstoapp/views/users/collectionsDone! :D.