Skip to content

Commit

Permalink
Merge pull request #2175 from jordan-brough/dependent-destroy-shippin…
Browse files Browse the repository at this point in the history
…g-method-zones

Add `dependent: :destroy` for ShippingMethodZones join model
  • Loading branch information
gmacdougall authored Aug 23, 2017
2 parents a3836f3 + d99ef8b commit 3f6a29e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/shipping_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 3f6a29e

Please sign in to comment.