From b4d1f186f5685294b85e87b132e96a817eabbfc2 Mon Sep 17 00:00:00 2001 From: Jeff Squires Date: Wed, 20 Nov 2013 22:25:28 -0500 Subject: [PATCH] made some possibly-unecessary changes to the way the calculators are set up --- app/models/spree/calculator/customization_image.rb | 2 ++ app/models/spree/calculator/engraving.rb | 2 ++ app/models/spree/calculator/no_charge.rb | 2 ++ lib/spree_flexi_variants/engine.rb | 13 ++++--------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/models/spree/calculator/customization_image.rb b/app/models/spree/calculator/customization_image.rb index be6e424..9c95df2 100644 --- a/app/models/spree/calculator/customization_image.rb +++ b/app/models/spree/calculator/customization_image.rb @@ -1,3 +1,5 @@ +require_dependency 'spree/calculator' + module Spree class Calculator::CustomizationImage < Calculator preference :price, :decimal diff --git a/app/models/spree/calculator/engraving.rb b/app/models/spree/calculator/engraving.rb index a5cb49b..d62067e 100644 --- a/app/models/spree/calculator/engraving.rb +++ b/app/models/spree/calculator/engraving.rb @@ -1,3 +1,5 @@ +require_dependency 'spree/calculator' + module Spree class Calculator::Engraving < Calculator preference :price_per_letter, :decimal diff --git a/app/models/spree/calculator/no_charge.rb b/app/models/spree/calculator/no_charge.rb index 15f215b..d5f5ae6 100644 --- a/app/models/spree/calculator/no_charge.rb +++ b/app/models/spree/calculator/no_charge.rb @@ -1,3 +1,5 @@ +require_dependency 'spree/calculator' + module Spree class Calculator::NoCharge < Calculator def self.description diff --git a/lib/spree_flexi_variants/engine.rb b/lib/spree_flexi_variants/engine.rb index 06e671c..8376cbd 100644 --- a/lib/spree_flexi_variants/engine.rb +++ b/lib/spree_flexi_variants/engine.rb @@ -28,21 +28,16 @@ def self.activate initializer "spree.flexi_variants.assets.precompile" do |app| app.config.assets.precompile += ['store/spree_flexi_variants_exclusions.js','admin/orders/flexi_configuration.js','store/spree-flexi-variants.*'] end - # Had a good reason for this rescue below, and wish I'd commented it better when I wrote it - # TODO - figure this out and de-ugly - begin - initializer "spree.register.calculators" do |app| - app.config.spree.calculators.add_class('product_customization_types') - app.config.spree.calculators.product_customization_types = [ + + initializer "spree.flexi_variants.register.calculators" do |app| + app.config.spree.calculators.add_class('product_customization_types') + app.config.spree.calculators.product_customization_types = [ Spree::Calculator::Engraving, Spree::Calculator::AmountTimesConstant, Spree::Calculator::ProductArea, Spree::Calculator::CustomizationImage, Spree::Calculator::NoCharge ] - end - rescue => problem - puts "intentionally ignoring problem in calculator registration #{problem}" end end end