I'm using the Ancestry Gem for my project. How do I set the root
path to one of the Ancestry paths?
My page named home
looks like this: http://127.0.0.1:3000/pages/15
. It's ideal to have http://127.0.0.1:3000/pages/home
and not the home id, but that's the next challenge.
I started with:
Rails.application.routes.draw do
# resources :pages
...
root 'pages#index', as: 'pages_index'
...
end
And of course it showed me the list of pages, but I would like to target the page named home, or in this case id 15. How do I do this?
You could use defaults
:
root 'pages#show', defaults: { id: 15 }