Ruby on rails 嵌套表单删除不起作用
我使用嵌套的_表单来添加和删除嵌套的_属性Ruby on rails 嵌套表单删除不起作用,ruby-on-rails,ruby,ruby-on-rails-3.1,nested-forms,Ruby On Rails,Ruby,Ruby On Rails 3.1,Nested Forms,我使用嵌套的_表单来添加和删除嵌套的_属性 class Text < ActiveRecord::Base attr_accessible :attachments_attributes has_many :attachments, :as => :attachable accepts_nested_attributes_for :attachments end 更新方法中参数的输出为 attachments_attributes: '0': descrip
class Text < ActiveRecord::Base
attr_accessible :attachments_attributes
has_many :attachments, :as => :attachable
accepts_nested_attributes_for :attachments
end
更新方法中参数的输出为
attachments_attributes:
'0':
description: asdf asdf as fs
_destroy: '1'
id: '2'
'1':
description: ''
_destroy: '1'
id: '3'
'2':
description: asdsadasd
_destroy: '1'
id: '4'
我找不到问题,你知道哪里出了问题吗
谢谢大家!!
如果有不清楚的地方,请留言 添加
:允许销毁=>true
到接受:附件的嵌套属性
accepts_nested_attributes_for :attachments, :allow_destroy => true
更多信息添加:允许销毁=>true
到接受:附件的嵌套属性
accepts_nested_attributes_for :attachments, :allow_destroy => true
更多信息
accepts_nested_attributes_for :attachments, :allow_destroy => true