In order to remove "sections" and "pages" from all routes for both sections
and pages
, you could use:
resources :sections, path: '' do
resources :pages, path: ''
end
Important: be sure to put this to the bottom of your routes page. For instance, it you have an example
controller, and say your routes.rb
appeared as follows:
resources :sections, path: '' do
resources :pages, path: ''
end
resources :examples
root 'home#index'
With the above setup, going to http://example.com/examples
would send you to the "examples" section
, rather than than examples#index
, and going to http://example.com/
would send you to sections#index
rather than home#index
. So, the above configuration should look like this:
resources :examples
root 'home#index'
resources :sections, path: '' do
resources :pages, path: ''
end