Rails Nested Forms Attributes not saving if Fields Added with jQuery

瘦欲@ 提交于 2019-12-03 08:43:18

Have you tried adding:

class Itinerary < ActiveRecord::Base
  attr_accessible :move_id, :trips_attributes
  accepts_nested_attributes_for :trips
end

Of course you would then need to add the fields for your Itinerary model also. Without knowing those I would be guessing what they are.

I had exactly the same problem as you. I fixed it by removing the line

validates_associated :parent_model

from the nested model (in your case the Trip model).

I was having similar issue. Removing the attr_accessible line from parent model did the trick for me. I see that your Itenerary model is already devoid of that line, so this might not help you; but might help someone else.

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