Action :: Controller表示在link_to方法中profile profile的值为nil。这是我的代码:
<p id="notice"><%= notice %></p>
<h2>Listing Schools</h2>
<table>
<thead>
<tr>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @schools.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= link_to edit_user_profile_school_path(current_user, school) %>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New School', new_school_path %>
答案 0 :(得分:0)
您需要指定params的密钥:
<%= link_to edit_user_profile_school_path(profile_id: current_user.id, school_id: school.id) %>
假设您的路线类似于:
post 'users/:profile_id/schools/:school_id'
很难说没有看到更多代码,但看起来你错过了:你的参数中的profile_id