Generalise fix for missing EnterpriseFee::Calculator to any use of calculated_adjustments

This commit is contained in:
Rohan Mitchell
2016-05-20 11:01:54 +10:00
parent 0d4c4f20df
commit a0b740f52d
4 changed files with 16 additions and 3 deletions

View File

@@ -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

View File

@@ -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"

View 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

View File

@@ -1,3 +1,4 @@
require 'spec_helper'
require 'open_food_network/enterprise_fee_applicator'
module OpenFoodNetwork