-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookup problems with gem which integrates zeitwerk #300
Comments
Usage of Zeitwerk in that gem seems correct at first sight. Could you please add |
Is it possible that it is connected to this custom inflection rule? I truncated the log to only include the parts which I believe are relevant, I hope I didn't leave anything important out.
Notably, the line
only appears on the initial app load, but not when reloading. |
In principle, the inflection rule looks good. The namespace Do the logs mention |
There are a bunch of those messages, such as
However, there is no such message for |
Cool, I could reproduce. Let me investigate. |
It was a bug, an edge case that happened specifically when 3rd party code reopened the main namespace of a gem dependency also managed by Zeitwerk. I have released 2.6.18 with the fix. Can you give it a try? |
2.6.18 fixes the issue - thanks for the quick turnaround! |
I'm using https://github.com/mbleigh/acts-as-taggable-on in a rails project (version 7.1.4 at the moment). I also use the pundit gem for authorization, and it expects that policies are defined as follows:
If I have a
Post
-model, it expects aPostPolicy
-class to be defined which contains the authorization logic (see https://github.com/varvet/pundit?tab=readme-ov-file#policies for more).acts-as-taggable-on
has just released a new version, in which it adopts zeitwerk for autoloading (in this PR I believe: mbleigh/acts-as-taggable-on#1132).So, in order to use
pundit
andacts-as-taggable-on
together, I define a class namedActsAsTaggableOn::TagPolicy
in my codebase. This works when the app initially boots, but as soon as code reloads, it can no longer findActsAsTaggableOn::TagPolicy
, raising a NameError (it's enough to open a console and issue areload!
). When I downgradeacts-as-taggable-on
to before it switched to zeitwerk, the problem goes away.Is this a fundamental limitation when a gem uses zeitwerk for autoloading itself, or is something off with how this was implemented in
acts-as-taggable-on
?The text was updated successfully, but these errors were encountered: