Skip to content

Commit

Permalink
Refactor(LegacyPromotions): Explicitly load state machine decorator
Browse files Browse the repository at this point in the history
Solidus Support's new Zeitwerk-based loading mechanism only works for
decorating autoloaded classes. The order state machine is in `lib`, and
thus is not autoloaded, so this decorator is not loaded either unless we explicitly
load it.
  • Loading branch information
mamhoff committed Nov 20, 2024
1 parent 9fdaf3f commit e639857
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions legacy_promotions/lib/solidus_legacy_promotions/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module SolidusLegacyPromotions
class Engine < ::Rails::Engine
include SolidusSupport::EngineExtensions

initializer "solidus_legacy_promotions.patch_state_machine", after: "spree.load_config_initializers" do
config.to_prepare { SolidusLegacyPromotions::SpreeOrderStateMachineDecorator }
end

initializer "solidus_legacy_promotions.add_backend_menu_item" do
if SolidusSupport.backend_available?
promotions_menu_item = Spree::BackendConfiguration::MenuItem.new(
Expand Down

0 comments on commit e639857

Please sign in to comment.