Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Replaced `Product#taxonomy_ids` with a proper `Product#taxonomies` association
Damian Legawiec8e7a0d7813b5
diff --git a/core/app/models/spree/product.rb b/core/app/models/spree/product.rbindex fcc5e42bdb..b55903a41a 100644--- a/core/app/models/spree/product.rb+++ b/core/app/models/spree/product.rb@@ -78,6 +78,7 @@ module Spreehas_many :classifications, dependent: :delete_all, inverse_of: :producthas_many :taxons, through: :classifications, before_remove: :remove_taxon+ has_many :taxonomies, through: :taxonshas_many :product_promotion_rules, class_name: 'Spree::ProductPromotionRule'has_many :promotion_rules, through: :product_promotion_rules, class_name: 'Spree::PromotionRule'@@ -580,11 +581,6 @@ module Spree@taxon_and_ancestors ||= taxons.map(&:self_and_ancestors).flatten.uniqend- # Get the taxonomy ids of all taxons assigned to this product and their ancestors.- def taxonomy_ids- @taxonomy_ids ||= taxon_and_ancestors.map(&:taxonomy_id).flatten.uniq- end-# Iterate through this products taxons and taxonomies and touch their timestamps in a batchdef touch_taxonsSpree::Taxon.where(id: taxon_and_ancestors.map(&:id)).update_all(updated_at: Time.current)