-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Zeitwerk breaks override pattern #36100
Comments
@fxn could you please to give some advice? |
Could you please try adding this? # config/application.rb
load_defaults "6.0"
Rails.autoloaders.main.ignore("#{Rails.root}/app/overrides") |
@fxn |
Awesome! |
tavyy
pushed a commit
to DFE-Digital/get-help-to-retrain
that referenced
this issue
Sep 2, 2019
Zeitwerk breaks the override pattern e.g expected file /get-help-to-retrain/app/admin/categories.rb to define constant Categories, but didn't (NameError), we need to ignore the exceptions. This approach clashes with ActiveAdmin in our case, as all related files live under /admin but do not have the expected structure. The fix is to ignore the files that break this expected behaviour, by doing something like: Rails.autoloaders.main.ignore("#{Rails.root}/app/admin") Resource: rails/rails#36100
tavyy
pushed a commit
to DFE-Digital/get-help-to-retrain
that referenced
this issue
Sep 2, 2019
Zeitwerk breaks the override pattern e.g expected file /get-help-to-retrain/app/admin/categories.rb to define constant Categories, but didn't (NameError), we need to ignore the exceptions. This approach clashes with ActiveAdmin in our case, as all related files live under /admin but do not have the expected structure. The fix is to ignore the files that break this expected behaviour, by doing something like: Rails.autoloaders.main.ignore("#{Rails.root}/app/admin") Resource: rails/rails#36100
Didn't seem to happen. @fxn's suggested fix needs broader exposure as |
@jasl Thanks for pointing out the link I've missed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Follow https://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers create an override (monkey patch) for a class
This works before 6.0.0.rc1 (including 6.0.0.beta2, 6.0.0.beta3)
Expected behavior
Class should be patched
Actual behavior
System configuration
Rails version: 6.0.0.rc1
Ruby version: 2.6.3
The text was updated successfully, but these errors were encountered: