我正在寻找两次嵌套属性表单的解决方案。球队有几个球员,每个球员有几轮。我在模型中添加了accept_nested_attributes。 这种方式对我没用。
<% form_for(@team) do |team_fields| %>
...SOME FIELDS...
<% team_fields.fields_for :players do |player_fields| %>...SOME FIELDS...
<% player_fields.fields_for :rounds do |round_fields| %>
<%= round_fields.text_field :message%>
<%end%>
<%end%>
<%end%>
答案 0 :(得分:2)
尝试将您的来电打印到.fields_for
。
<%= player_fields.fields_for :rounds do |round_fields| %>