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

0.9.4 breaks because of autoloading on Rails 5.2 under certain conditions #329

Closed
halfbyte opened this issue Nov 3, 2020 · 2 comments
Closed

Comments

@halfbyte
Copy link

halfbyte commented Nov 3, 2020

I was getting super weird errors about missing helper methods today after upgrading to 0.9.4 with my Rails 5.2.x app and after tons of fruitless debugging I finally found out that probably due to some autoloading issues Trestle::AdminController was extending ApplicationController (of my app) instead of Trestle::ApplicationController and thus missing all the helpers etc.

I was able to fix by either inheriting from ::Trestle::ApplicationController (by patching my local Trestle install) or trying to trick the loader into loading Trestle::ApplicationController in the initializer in the hopes it loads before ApplicationController.

I'm totally not sure what the correct solution here is but seeing @spohlenz had already various collisions with autoloading in past issues, I hope there's a solution that will work with 5.2.x as well? (We're not too far away from upgrading but there are 1-2 deps that keep us from doing that right now...)

I'm not sure how easy it would be to create a minimal repro app, but if you want me to try, I will.

@aleksclark
Copy link

just ran into the same thing, on a rails 6 app with 5.0 defaults loaded. setting config.autoload = :zeitwerk didn't seem to help

@spohlenz
Copy link
Member

Autoloading strikes again! This should now be fixed in master.

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

No branches or pull requests

3 participants