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

jbf034 · April 23, 2019 · Last by doodooke replied at April 26, 2019 · 1129 hits
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)

哪位大神,帮帮我!

You need to Sign in before reply, if you don't have an account, please Sign up first.