Use dependent: :restrict_with_error on Taxon/Product association

This commit is contained in:
Matt-Yorkley
2023-08-08 11:33:43 +01:00
parent 1706b8b4bc
commit 6fee1d2dde

View File

@@ -6,7 +6,7 @@ module Spree
belongs_to :taxonomy, class_name: 'Spree::Taxonomy', touch: true
has_many :products, class_name: "Spree::Product", foreign_key: "primary_taxon_id",
inverse_of: :primary_taxon
inverse_of: :primary_taxon, dependent: :restrict_with_error
before_create :set_permalink