diff --git a/core/app/models/spree/shipping_method.rb b/core/app/models/spree/shipping_method.rb index 2f6ca280677..ce4a246d475 100644 --- a/core/app/models/spree/shipping_method.rb +++ b/core/app/models/spree/shipping_method.rb @@ -16,7 +16,7 @@ class ShippingMethod < Spree::Base has_many :shipments, through: :shipping_rates has_many :cartons, inverse_of: :shipping_method - has_many :shipping_method_zones + has_many :shipping_method_zones, dependent: :destroy has_many :zones, through: :shipping_method_zones belongs_to :tax_category, -> { with_deleted }, class_name: 'Spree::TaxCategory' diff --git a/core/app/models/spree/zone.rb b/core/app/models/spree/zone.rb index 5283182fe1c..01eb070279b 100644 --- a/core/app/models/spree/zone.rb +++ b/core/app/models/spree/zone.rb @@ -8,7 +8,7 @@ class Zone < Spree::Base has_many :states, source_type: "Spree::State" end - has_many :shipping_method_zones + has_many :shipping_method_zones, dependent: :destroy has_many :shipping_methods, through: :shipping_method_zones validates :name, presence: true, uniqueness: { allow_blank: true }