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
Question
I am trying to create a nested route like this:
resources :storyboards, path: "" do
resources :stories, path:""
end
This renders the following path params:
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:
- Create separate
new
route forstoryboards
controller (to override the other)- Somehow get rails to render the nested routes under the parent
If anyone has experience in this, your insight would be greatly appreciated!
La solution
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