0
我有问题许可证关于RALS双嵌套fields_for 4.示例关系:嵌套fields_for导轨4
Service - > has_many :product_services
accepts_nested_attributes_for :product_services, allow_destroy: true
Product Service -> has_many :foto_product_services
accepts_nested_attributes_for :foto_product_services, allow_destroy: true
服务 - > new.html.slim
= form_for @service, :html => {:multipart => true} do |f|
= f.fields_for :product_services do |builder|
= render 'field_product', f: builder
= f.submit
服务 - > _field_product.html .slim
= f.text_field :price, :class => 'text_field input-lg width-100'
= f.fields_for :foto_product_services do |builder|
= builder.file_field "avatar[]", type: :file, multiple: true
许可证PARAMS在我的服务控制器
def service_params
params.require(:service).permit(:service_category_id, :title, :description, :product_services_attributes => [:title, "_destroy"], :foto_product_services_attributes => [:avatar])
end
当我点击按钮提交后选择照片产品,我得到错误未经许可的参数:foto_product_services_attributes。