Add extension paths before initialize_cache
#71
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 havealready 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 alsochange the load paths before
set_load_path
. To ensure that ourextension paths are not affected by those gems, we work around those gems by
adding our paths before
initialize_cache
, which is the Rails initializercalled before
set_load_path
.References
bin/rails initializers
- Shows list of active initializersTesting
Tested on SolidusPaypalCommercePlatform: