I have the following resources setup:
resources :sites do
resources :documents
# more nested here
end
resources :documents do
resources :notes, :except => [:show, :new, :edit]
end
I want the notes controller to have the document context. The problem is, the document controller itself depends on the site context. So the /document urls that are created from the above all throw a 500 error. I could adjust the controller code to handle this, but i wonder if there’s a way to not create the /document urls, just: /document/#id/notes
For any one else that may have this problem You can restrict the routes you don’t want by using :except just the way @agmcleod has for the :notes. So to restrict the document urls would either be:
or
You can remove any of the actions as necessary.