Merged
Conversation
This enables using patches (i.e. "decorators"/"overrides") in Solidus engines, but using the style described in the Flickwerk README[^1] In short, this allows autoloading patches whenever the file being patches is loaded by Zeitwerk. The new directory to put your patches into would be `app/patches`, and the files inside should be named `my_extension/spree_user_patch.rb` and define a constant `MyExtension::SpreeUserPatch`. The convention is that the module prepends itself to the class being patched, in this example `Spree::User`. [^1] https://github.com/friendlycart/flickwerk/blob/main/README.md
jarednorman
approved these changes
Dec 11, 2024
Member
jarednorman
left a comment
There was a problem hiding this comment.
This looks great. I love how the work you've done on flickwerk makes this change so simple.
Member
|
Looks promising! We did something similar in the past, with Prependers but it never took off (p.s. I'd like your opinion on the different approach used there, but in the past Zeitwerk wasn't as complete as today). By the way, I'd like to explore a couple of things:
Thanks again for the stellar work as always. |
Contributor
Author
|
Contributor
Author
|
Honestly, I looked at |
Contributor
Author
|
Script is here: friendlycart/flickwerk#2 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This enables using patches (i.e. "decorators"/"overrides") in Solidus engines, but using the style described in the Flickwerk README.
In short, this allows autoloading patches whenever the file being patches is loaded by Zeitwerk.
The new directory to put your patches into would be
app/patches, and the files inside should be namedmy_extension/spree_user_patch.rband define a constantMyExtension::SpreeUserPatch. The convention is that the module prepends itself to the class being patched, in this exampleSpree::User.The following are mandatory for all PRs:
The following are not always needed: