Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extension paths before
initialize_cache
solidus_support v0.9.0, released on May 26, 2022, included a commit that fixes the load order of adding extension paths. See 202e77c. The commit depends on the `initialize_dependency_mechanism` Rails initializer (https://github.com/rails/rails/blob/127dd06df66552dd272eea7832f8bb205cf6fd01/railties/lib/rails/application/bootstrap.rb#L68). However, that initiliazer was removed in Rails 7.0.3 (rails/rails@0375657). The extension paths initializer has been updated to run before `initialize_cache`. `initialize_cache` runs 1) after the Solidus engines have already loaded BUT 2) before Rails has added the paths to `$LOAD_PATH`. Normally, it would be sufficient to run the initializer before the `set_load_path` initializer. However, external gems such as Deface may also change the load paths before `set_load_path`. To ensure that our extension paths are not affected by those gems, we work around those gems by adding our paths before `initialize_cache`, which is the Rails initializer called before `set_load_path`. References ---------- * `bin/rails initializers` - Shows list of active initializers * List of Rails initializers: https://guides.rubyonrails.org/configuring.html#initializers * Engine paths configuration - See Paths section in https://api.rubyonrails.org/v7.0.3/classes/Rails/Engine.html.
- Loading branch information