Pergunta

I am trying to create a nested route like this:

resources :storyboards, path: "" do
  resources :stories, path:""
end

This renders the following path params:

enter image description here


Because the nested route is defined before the parent, Rails is ignoring our /new route for our parent controller. I was wondering if anyone has achieved what we're trying to (using path: "" for nested routes)?

I believe the two fixes would be:

  1. Create separate new route for storyboards controller (to override the other)
  2. Somehow get rails to render the nested routes under the parent

If anyone has experience in this, your insight would be greatly appreciated!

Foi útil?

Solução

With help from @babar, we managed to fix the error with a small hack:

#config/routes.rb
get "new", to: "storyboards#new"
resources :storyboards, path: "" do
    resources :stories
end
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top