新手问题 关于一个 (一个男人多个老婆) 嵌套表单的问题

jbf034 · 2019年04月23日 · 最后由 doodooke 回复于 2019年04月26日 · 1129 次阅读
Husband.rb
   has_many :wives
  accepts_nested_attributes_for :wives
Wife.rb
    belongs_to :husband

参数为 "adf", "sex"=>"男", "wives"=>["adf", "noun"=>"adf", "order"=>"1", "remark"=>"阿道夫"} permitted: true>]} permitted: true>

create 时抛 *** ActiveRecord::AssociationTypeMismatch Exception: Wife(#70041826867080) expected, got {"name"=>"adf", "noun"=>"adf", "order"=>"1", "remark"=>"阿道夫"} which is an instance of ActiveSupport::HashWithIndifferentAccess(#17478600)

哪位大神,帮帮我!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号