Skip to content

v1.3.1

Latest
Compare
Choose a tag to compare
@gibsorya gibsorya released this 02 Sep 21:45
· 126 commits to master since this release

Changelog From v1.3.0 To v1.3.1

#269 Fix autoloading in zeitwerk mode [@gburgett](https://watermark-dev.slack.com/team/U6U4QQ1UG) merged 2022-09-02 * Switches to use `const_get` which works in both classic and zeitwerk mode. * Added doc about a pitfall of Zeitwerk autoloading with app-defined model namespaces 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](https://ruby-doc.org/core-2.0.0/Module.html#method-i-autoload). 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/