A basic question about what happens when routes are nested. I have a form that's complaining about a missing path. I'm unable to figure out how to either name the path correctly in routes, or correctly change the path it's looking for.
Here the routes:
Rails.application.routes.draw do
resources :users do
resources :events do
resources :event_sessions do
resources :locations
end
end
end
end
And here's the form:
<%= form_for @event do |form| %>
...
<% end %>
The URL http://localhost:3000/users/2/events/new
produces an exception:
undefined method `event_path`
What's happening here? How do I solve this?