From 645cb10864d1736113ed5d51290ec37797eb8ecb Mon Sep 17 00:00:00 2001 From: Anthony Musyoki <445103+anthonyms@users.noreply.github.com> Date: Tue, 26 Mar 2024 10:01:02 +0300 Subject: [PATCH] Fix Rubocop: Do not delete Spree::Variant associations Spree::Variant acts_as_paranoid and is thus not hard deleted --- app/models/spree/variant.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/spree/variant.rb b/app/models/spree/variant.rb index c5f93e0de9..294c1edfe0 100644 --- a/app/models/spree/variant.rb +++ b/app/models/spree/variant.rb @@ -32,8 +32,8 @@ module Spree delegate :name, :name=, :description, :description=, :meta_keywords, to: :product - has_many :inventory_units, inverse_of: :variant - has_many :line_items, inverse_of: :variant + has_many :inventory_units, inverse_of: :variant, dependent: nil + has_many :line_items, inverse_of: :variant, dependent: nil has_many :stock_items, dependent: :destroy, inverse_of: :variant has_many :stock_locations, through: :stock_items @@ -53,7 +53,7 @@ module Spree :currency, :currency=, to: :find_or_build_default_price - has_many :exchange_variants + has_many :exchange_variants, dependent: nil has_many :exchanges, through: :exchange_variants has_many :variant_overrides, dependent: :destroy has_many :inventory_items, dependent: :destroy