Fix Rails/ActiveRecordOverride

This commit is contained in:
Neal Chambers
2023-08-20 22:15:22 +09:00
committed by Maikel Linke
parent a39c465692
commit 2bfa51cbb1
2 changed files with 6 additions and 12 deletions

View File

@@ -420,13 +420,6 @@ Naming/VariableNumber:
- 'spec/models/spree/tax_rate_spec.rb'
- 'spec/requests/api/orders_spec.rb'
# Offense count: 1
# Configuration parameters: Severity, Include.
# Include: app/models/**/*.rb
Rails/ActiveRecordOverride:
Exclude:
- 'app/models/spree/product.rb'
# Offense count: 47
# Configuration parameters: Include.
# Include: app/models/**/*.rb

View File

@@ -29,6 +29,10 @@ module Spree
acts_as_paranoid
after_create :ensure_standard_variant
around_destroy :destruction
after_save :update_units
searchable_attributes :supplier_id, :primary_taxon_id, :meta_keywords, :sku
searchable_associations :supplier, :properties, :primary_taxon, :variants
searchable_scopes :active, :with_properties
@@ -74,9 +78,6 @@ module Spree
attr_accessor :price, :display_as, :unit_value, :unit_description, :tax_category_id,
:shipping_category_id
after_create :ensure_standard_variant
after_save :update_units
scope :with_properties, ->(*property_ids) {
left_outer_joins(:product_properties).
left_outer_joins(:supplier_properties).
@@ -259,7 +260,7 @@ module Spree
variants.map(&:import_date).compact.max
end
def destroy
def destruction
transaction do
touch_distributors
@@ -267,7 +268,7 @@ module Spree
where('exchange_variants.variant_id IN (?)', variants.with_deleted.
select(:id)).destroy_all
super
yield
end
end