Skip to content
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

Fix for Rails 6: Zeitwerk class loading #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matugm
Copy link

@matugm matugm commented Sep 14, 2019

We have reports on this gem not working in Rails 6.

I looked into this & it seems like controllers aren't loaded with @all.eager_load! because of the new class autoloader, Zeitwerk.

This code, from Rails 6 eager_load!, shows that if Zeitwerk is enabled (default in Rails 6), then it returns & does nothing.

Calling Zeitwerk::Loader.eager_load_all fixes that.

@matugm matugm changed the title Fix for Rails 6: Zeitwerk class loading (Fix #36) Fix for Rails 6: Zeitwerk class loading (#36) Sep 14, 2019
@matugm matugm changed the title Fix for Rails 6: Zeitwerk class loading (#36) Fix for Rails 6: Zeitwerk class loading Sep 14, 2019
@amatsuda
Copy link
Owner

Thank you for the patch and detailed report!
But for now I'd like to see how this issue is treated upstream: rails/rails#37045

@vieditcom
Copy link

Rails 6.0.2. Can confirm this pull request fixing behavior for ROUTES checking. However output is still showing ALL actions for "unused actions".

@MatheusRich
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants