Rails 4: fields_for in fields_for

落花浮王杯 提交于 2019-12-02 21:59:09

Try switching:

<%= f.fields_for :grandfather do |fff| %>

to:

<%= ff.fields_for :grandfather do |fff| %>

And switching:

params.require(:child).permit(:name, father_attributes:[:name], grandfather_attributes:[:name])

To:

params.require(:child).permit(:name, father_attributes:[:name, grandfather_attributes:[:name]])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!