Constant autoloading in ruby on rails
summary
Explains how Active Support implements Ruby constant autoloading and development-mode code reloading by hooking into cons_missing hook, scanning autoload_paths directories, and tracking which constants and filenames load so reloading removes those constants and forces re-evaluation. Covers constant resolution rules, the trade-offs and failure modes (anonymous eval, nesting unknowns), the file update checker optimization, nonthread safety of on‑demand autoloading, and conventions required for predictable behavior.
AI-written summary · about
chapters (7)
- 0:00Start
- 0:12Constant Autoloading and Ruby on Rails
- 2:34Constant Assignment
- 9:31Constant Resolution Algorithms
- 15:16Constant Auto Loading
- 24:38Nesting
- 33:38File Update Checker
related talks
45mClass Reloading in Ruby on Rails: The Whole Story
44mrequire() bombed my multi-threaded app!
42mZeitwerk: A new code loader
29mHow to Load 1m Lines of Ruby in 5s
58mZeitwerk: A new code loader for Ruby
31mHow to load 1m lines of Ruby in 5s
34mZeitwerk Internals
28mIn the beginning, there was "require"...
