From fec59e5ae2e7f4df5605d9bfa4e385e5ae4d6e81 Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Tue, 3 Oct 2023 09:49:24 +0900 Subject: [PATCH] Apply Changes Suggested by Code Review --- app/models/spree/payment.rb | 2 +- app/models/spree/shipping_method.rb | 2 +- app/models/spree/variant.rb | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/spree/payment.rb b/app/models/spree/payment.rb index 4bb1bd7304..6f32de6f9b 100644 --- a/app/models/spree/payment.rb +++ b/app/models/spree/payment.rb @@ -21,7 +21,7 @@ module Spree belongs_to :payment_method, class_name: 'Spree::PaymentMethod' has_many :offsets, -> { where("source_type = 'Spree::Payment' AND amount < 0").completed }, - class_name: "Spree::Payment", foreign_key: :source_id, dependent: :nullify + class_name: "Spree::Payment", foreign_key: :source_id, dependent: :restrict_with_exception has_many :log_entries, as: :source, dependent: :destroy has_one :adjustment, as: :adjustable, dependent: :destroy diff --git a/app/models/spree/shipping_method.rb b/app/models/spree/shipping_method.rb index fea4601d9e..42ab253ef7 100644 --- a/app/models/spree/shipping_method.rb +++ b/app/models/spree/shipping_method.rb @@ -16,7 +16,7 @@ module Spree has_many :shipping_rates, inverse_of: :shipping_method, dependent: :destroy has_many :shipments, through: :shipping_rates has_many :shipping_method_categories, dependent: :destroy - has_many :shipping_categories, through: :shipping_method_categories, dependent: nil + has_many :shipping_categories, through: :shipping_method_categories has_many :distributor_shipping_methods, dependent: :destroy has_many :distributors, through: :distributor_shipping_methods, class_name: 'Enterprise', diff --git a/app/models/spree/variant.rb b/app/models/spree/variant.rb index da462602b0..db87d93d74 100644 --- a/app/models/spree/variant.rb +++ b/app/models/spree/variant.rb @@ -38,7 +38,6 @@ module Spree has_many :stock_items, dependent: :destroy, inverse_of: :variant has_many :stock_locations, through: :stock_items - has_many :stock_movements, through: :stock_items, dependent: :destroy has_many :images, -> { order(:position) }, as: :viewable, dependent: :destroy, class_name: "Spree::Image"