mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Generalise fix for missing EnterpriseFee::Calculator to any use of calculated_adjustments
This commit is contained in:
@@ -16,9 +16,6 @@ class EnterpriseFee < ActiveRecord::Base
|
||||
|
||||
calculated_adjustments
|
||||
|
||||
# Class name is mis-inferred outside of Spree namespace
|
||||
has_one :calculator, as: :calculable, dependent: :destroy, class_name: 'Spree::Calculator'
|
||||
|
||||
|
||||
attr_accessible :enterprise_id, :fee_type, :name, :tax_category_id, :calculator_type, :inherits_tax_category
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
require 'spree/product_filters'
|
||||
require 'spree/core/calculated_adjustments_decorator'
|
||||
|
||||
require "#{Rails.root}/app/models/spree/payment_method_decorator"
|
||||
require "#{Rails.root}/app/models/spree/gateway_decorator"
|
||||
|
||||
14
lib/spree/core/calculated_adjustments_decorator.rb
Normal file
14
lib/spree/core/calculated_adjustments_decorator.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Spree
|
||||
module Core
|
||||
module CalculatedAdjustments
|
||||
module ClassMethods
|
||||
def calculated_adjustments_with_explicit_class_name
|
||||
calculated_adjustments_without_explicit_class_name
|
||||
# Class name is mis-inferred outside of Spree namespace
|
||||
has_one :calculator, as: :calculable, dependent: :destroy, class_name: 'Spree::Calculator'
|
||||
end
|
||||
alias_method_chain :calculated_adjustments, :explicit_class_name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,3 +1,4 @@
|
||||
require 'spec_helper'
|
||||
require 'open_food_network/enterprise_fee_applicator'
|
||||
|
||||
module OpenFoodNetwork
|
||||
|
||||
Reference in New Issue
Block a user