Skip to content

Commit

Permalink
Register modules after app initialization (#74)
Browse files Browse the repository at this point in the history
If we do this earlier, Zeitwerk will autoload files from other engines.
This, in turn, leads to configuration from the local app's
`config/initializers` directory not being respected when loading files
from those other engines.

Case in point: When configuring Solidus' order state machine in Solidus
2.11 using `Spree::Config.state_machines.order =
  "MyOrderStateMachineModule"`, and this change is not in the gem,
Solidus' `Spree::Order` class is loaded, and the wrong module is
included.
  • Loading branch information
mamhoff authored May 12, 2021
1 parent 91350b1 commit 3a9438c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/initializers/alchemy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@
end
end

Alchemy::Modules.register_module(alchemy_module)
Rails.application.config.after_initialize do
Alchemy::Modules.register_module(alchemy_module)
end

0 comments on commit 3a9438c

Please sign in to comment.