我有 3 张桌子:
profiles, users, payment_details
现在,在models/user.rb我有以下内容:
has_one :profile, :dependent => :destroy
has_one :payment_detail, :dependent => :destroy
在models/profile.rb我有:
has_one :payment_detail, :through => :user
在models/payment_details.rb我有:
has_one :profile, :through => :user
然后我有一个:profile带有:payment_details嵌套表单的表单。
由于某种原因,使用from而不是from:payment_details获取:user_id更新:id:profiles:user_id:profiles