ActiveRecord::AssociationTypeMismatch when attempting to save nested attributes in Rails

后端 未结 3 552
清歌不尽
清歌不尽 2021-01-13 20:58

I read through a lot of pages on `has_one relationships and nested attributes but haven\'t been successful in making this work. Any help would be fantastic.

Each Use

3条回答
  •  逝去的感伤
    2021-01-13 21:15

    Incase someone else is having the same issue, I resolved this by changing:

    <%= f.fields_for @network do |fn| %> to <%= f.fields_for :network do |fn| %> and removing :network as an accessible attribute from the user model.

提交回复
热议问题