I need help with routes. Here are my current routes.
resources :users, :only => [:index, :show, :create, :destroy] do resources :links, :only => [:create, :destroy], :shallow => true, :on => :member end
and when I run rake routes I get this
root /(.:format) {:controller=>"users", :action=>"index"} user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"links"} link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"links"} users GET /users(.:format) {:action=>"index", :controller=>"users"} POST /users(.:format) {:action=>"create", :controller=>"users"} user GET /users/:id(.:format) {:action=>"show", :controller=>"users"} DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
but I try to make my routes the same as I had, but I donโt remember how I got it to work. :(
root /(.:format) {:controller=>"users", :action=>"index"} user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"users/links"} link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"users/links"} users GET /users(.:format) {:action=>"index", :controller=>"users"} POST /users(.:format) {:action=>"create", :controller=>"users"} user GET /users/:id(.:format) {:action=>"show", :controller=>"users"} DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
What am I doing wrong? What am I missing?
Edit:
I think that the above does not say very much. The differences in the routes are as follows.
user_links POST {:action=>"create", :controller=>"links"} link DELETE {:action=>"destroy", :controller=>"links"} user_links POST {:action=>"create", :controller=>"users/links"} link DELETE {:action=>"destroy", :controller=>"users/links"}
Perhaps this will help a bit.