0
在我的項目中,我有三個模型產品,頁面和圖片。產品has_one :page
和has_many :pictures
與accepts_nested_attributes_for :page, :pictures
。Rails 5.02參數不允許錯誤?
在products_controller
我已經加入product_params
爲:
def product_params
params.require(:product).permit(:name, :model, :price, page_attributes: [:content], pictures_attributes: [:file])
end
但是,當我提出創建,但Picture
形式Product
和Page
不會被保存。 控制檯顯示消息picture and page unpermitted
可能是什麼原因?請建議。