Apply Changes Suggested by Code Review

This commit is contained in:
Neal Chambers
2023-10-03 09:49:24 +09:00
parent cf07a055d0
commit fec59e5ae2
3 changed files with 2 additions and 3 deletions

View File

@@ -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

View File

@@ -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',

View File

@@ -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"