关于ROR ONE_TO_ONE时,嵌套表单显示不出来的问题





In your code:

<% f.fields_for :profile do |profile_form| %> 

Doesn't that need to be written like this (due to Rails 3 new behavior):

<%= f.fields_for :profile do |profile_form| %>
当one to one 类型的表关系,想通过nested关系嵌套form实现,在form这个级别里,记得fields_for前面要加=才好用。

而如果是下一级,也就是form里面的one to many的fields_for里面再嵌套一级one to none,则不需要等号=。

你可能感兴趣的:(关于ROR ONE_TO_ONE时,嵌套表单显示不出来的问题)