我正在寻找一个两次嵌套属性表单的解决方案。团队有几个玩家,每个玩家有几个回合。我在模型中添加了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%>
尝试打印对.fields_for
的调用。
<%= player_fields.fields_for :rounds do |round_fields| %>