RubyOnRails允许您使用一个深度哈希来访问与主模型关联的对象的属性。如果您在定义`accepts_nested_attributes_for`的模型中遇到问题,或者在视图中使用`fields_for`的嵌套调用,请使用此标记。
我有一个项目模型:class Project <ApplicationRecord has_many:site_visits,inverse_of :: project,dependent :: destroy accepted_nested_attributes_for:site_visits,allow_destroy:true,...
def upload_new_incident_attachments @ attachments.each do | attachment |如果record.new_record? record.images.build(附件:附件)else record.images ....