watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Fix autoloading in zeitwerk mode #269

Closed gburgett closed 2 years ago

gburgett commented 2 years ago

Rails 6 introduced the Zeitwerk autoloader which uses a completely different technique to load application models. The technique no longer depends on const_missing and in fact that method no longer works when a rails application is in :zeitwerk mode.

Instead, Zeitwerk depends on ruby's core "autoload" feature. It sets up the relationship between constants and files beforehand, instead of discovering them on-demand. The consequence of this is that const_get still works to get the constants, but Ruby (not Zeitwerk) auto-loads it on demand from the file. To the application, the constant exists regardless of whether it has been loaded or not.

More info: https://www.urbanautomaton.com/blog/2020/11/04/rails-autoloading-heaven/

watermarkchurch-bot commented 2 years ago
1 Warning
:warning: No issue referenced - please create an issue describing a single unit of work and reference it using "closes #[the issue number]"

Generated by :no_entry_sign: Danger

gburgett commented 2 years ago

@gibsorya please release a new patch version of wcc-contentful once you've confirmed that it works in paper-signs