diff --git a/app/models/spree/preferences/preferable.rb b/app/models/spree/preferences/preferable.rb index dd8fc41120..b55b763ada 100644 --- a/app/models/spree/preferences/preferable.rb +++ b/app/models/spree/preferences/preferable.rb @@ -11,8 +11,6 @@ # and copy all the definitions allowing the subclass to add # additional defintions without affecting the base -require 'spree/preferences/store' - module Spree module Preferences module Preferable diff --git a/config/application.rb b/config/application.rb index 175f191f45..f54fca0e4f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -89,7 +89,8 @@ module Openfoodnetwork end # Register Spree calculators - initializer 'spree.register.calculators' do |app| + Rails.application.reloader.to_prepare do + app = Openfoodnetwork::Application app.config.spree.calculators.shipping_methods = [ Calculator::FlatPercentItemTotal, Calculator::FlatRate, @@ -100,7 +101,7 @@ module Openfoodnetwork ] app.config.spree.calculators.add_class('enterprise_fees') - config.spree.calculators.enterprise_fees = [ + app.config.spree.calculators.enterprise_fees = [ Calculator::FlatPercentPerItem, Calculator::FlatRate, Calculator::FlexiRate, @@ -110,7 +111,7 @@ module Openfoodnetwork ] app.config.spree.calculators.add_class('payment_methods') - config.spree.calculators.payment_methods = [ + app.config.spree.calculators.payment_methods = [ Calculator::FlatPercentItemTotal, Calculator::FlatRate, Calculator::FlexiRate, @@ -119,7 +120,7 @@ module Openfoodnetwork ] app.config.spree.calculators.add_class('tax_rates') - config.spree.calculators.tax_rates = [ + app.config.spree.calculators.tax_rates = [ Calculator::DefaultTax ] end @@ -205,5 +206,7 @@ module Openfoodnetwork config.action_controller.include_all_helpers = false config.generators.template_engine = :haml + + config.autoloader = :zeitwerk end end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9e8b0131f8..e630d3121e 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -8,3 +8,8 @@ # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end +Rails.autoloaders.each do |autoloader| + autoloader.inflector.inflect( + "stripe_sca" => "StripeSCA" + ) +end