nested attributes in simple_form returns mass assignment error

隐身守侯 提交于 2019-12-04 15:27:04

Shouldn't you be using simple_fields_for for :topic?

simple_form_for @post do |f|
  f.simple_fields_for :topic do |topic_form|
    topic_form.input :name
  end
end

It isn't an error in simple_form. You should add post_id to attribute accessible in Topic model. This code will fail in console too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!