I've got two models/views, User
and PersonalInfo
and I'm trying to call the _form.html.erb
partial in the 'user#show'
action, but I'm getting an error:
No route matches {:controller=>"personal_info"}
I suspect the issue is that my PersonalInfo
routes are nested within the User
routes and Rails isn't using the right one, but I don't know how to make it use the right one. Here's the line that's calling the form:
app/views/users/show.html.erb
:
<%= render :partial => "/personal_info/form", :locals => {personal_info: @personal_info } %>
app/views/personal_info/_form.html.erb
:
<%= form_for @personal_info, url: user_personal_info_index_path, html: { method: :post } do |f| %>
routes.rb
:
resources :users do
resources :personal_info
end
Do I either have to declare something in the personal_info controller or specify the app to use the users/:user_id/personal_info
route?