7 Matching Annotations
- Nov 2023
-
-
Autoloading in Rails was based on const_missing up to Rails 5. That callback lacks fundamental information like the nesting or the resolution algorithm being used. Because of that, Rails autoloading was not able to match Ruby's semantics, and that introduced a series of issues. Zeitwerk is based on a different technique and fixed Rails autoloading starting with Rails 6.
-
On reload, the namespaces are safe, won't be reloaded. The loader only reloads what it manages, which in this case is the adapter itself.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
In this example, we still want app/models/shapes/circle.rb to define Circle, not Shapes::Circle. This may be your personal preference to keep things simple, and also avoids refactors in existing code bases. The collapsing feature of Zeitwerk allows us to do that:
-
-
-
Please note that you should also ignore subdirectories that are not meant to be namespaces. For example: Rails.autoloaders.main.ignore('lib/tasks', 'lib/assets') Otherwise, Zeitwerk would define a Tasks constant, but that is not your intention (and could potentially conflict with a genuine Tasks constant).
-
- Apr 2022
-
edgeguides.rubyonrails.org edgeguides.rubyonrails.org
-
All known use cases of require_dependency have been eliminated with Zeitwerk. You should grep the project and delete them.
-
-