Merge pull request #7947 from andrewpbrett/zeitwerk

Use zeitwerk for autoloading
This commit is contained in:
Matt-Yorkley
2021-08-05 00:36:32 +02:00
committed by GitHub
3 changed files with 12 additions and 6 deletions

View File

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

View File

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

View File

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