I have nested resources, and I'm trying to create form partials for each individual resource to use for the new and edit action of each.
routes.rb
resources :accounts, shallow: true, :except => [ :destroy ] do
resources :service, :except => [ :destroy ]
end
If I use the following in the form partial, the edit form renders correctly and saves updates correctly, but the new form fails to render with the error undefined method services_path
/app/views/services/_service_form.html.erb
<%= simple_form_for @service do |f| %>
If I use the following in the form partial, the new form renders correctly and saves the object correctly, but the edit form fails to render with the error undefined method account_service_path
/app/views/services/_service_form.html.erb
<%= simple_form_for [@account, @service] do |f| %>
I've tried adding url: service_path(@service)
to both versions of the form block declaration as shown, but it doesn't solve either problem.
There's bound to be something obvious I'm missing with getting this working, I'm sure I've had nested resources working correctly with a single form partial in the past, I just can't see what's different this time.