From 7700737cf391e39287383752370110a75c98d498 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 11 Oct 2022 16:40:45 +0200 Subject: [PATCH] (bug) fix cannot remove product if it has the relation with machines --- app/models/product.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/product.rb b/app/models/product.rb index b27a8cc5d..918e7c14b 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -8,7 +8,7 @@ class Product < ApplicationRecord belongs_to :product_category - has_many :machines_products, dependent: :destroy + has_many :machines_products, dependent: :delete_all has_many :machines, through: :machines_products has_many :product_files, as: :viewable, dependent: :destroy