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
Revert "Added `CalculatedAdjustments#cached_calculator`" (#13426)
Damian Legawieca166c3df9f08
diff --git a/core/app/models/concerns/spree/calculated_adjustments.rb b/core/app/models/concerns/spree/calculated_adjustments.rbindex 92b374b3e0..1c60331c5a 100644--- a/core/app/models/concerns/spree/calculated_adjustments.rb+++ b/core/app/models/concerns/spree/calculated_adjustments.rb@@ -6,7 +6,7 @@ module Spreehas_one :calculator, class_name: 'Spree::Calculator', as: :calculable, inverse_of: :calculable, dependent: :destroy, autosave: trueaccepts_nested_attributes_for :calculatorvalidates :calculator, presence: true- delegate :compute, to: :cached_calculator+ delegate :compute, to: :calculatorscope :with_calculator, ->(calculator) { joins(:calculator).where(calculator: { type: calculator.to_s }) }@@ -15,7 +15,7 @@ module Spreeenddef calculator_type- cached_calculator.class.to_s if cached_calculator+ calculator.class.to_s if calculatorenddef calculator_type=(calculator_type)@@ -23,16 +23,6 @@ module Spreeself.calculator = klass.new if klass && !calculator.instance_of?(klass)end- # Returns the calculator using Rails.cache to avoid repeated database lookups.- #- # @return [Object, nil] The calculator object (TaxRate, PromotionAction, etc.)- def cached_calculator- Rails.cache.fetch("#{cache_key_with_version}/calculator") { calculator }- rescue TypeError- # Handle objects that can't be serialized (e.g., mock objects in tests)- calculator- end-privatedef self.model_name_without_spree_namespace