From d99ef8bf145bae9f943107bec7736398330fafca Mon Sep 17 00:00:00 2001 From: Jordan Brough Date: Tue, 22 Aug 2017 06:12:49 -0600 Subject: [PATCH] Add `dependent: :destroy` for ShippingMethodZones join model --- core/app/models/spree/shipping_method.rb | 2 +- core/app/models/spree/zone.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 }