Class Reloading in Ruby on Rails: The Whole Story
summary
Explains how Rails implements live code changes by replacing Ruby’s default autoload path with a filesystem-backed resolver that loads with load in development and require in production, tracks which files provided which constants, and removes those constants on file change. Covers Ruby constant lookup, the constant autoloading heuristic Rails uses (directory backtracking and anonymous module creation), and the crucial cons_missing override that triggers loading and enables class reloading.
AI-written summary · about
chapters (10)
- 0:00Class reloading in Rails
- 2:29Ruby constants explained
- 11:47Constants and modules
- 17:32Ruby ancestors
- 21:10Constant lookup in Ruby
- 27:20Why Rails avoids autoload
- 30:12Rails autoloading
- 36:56Required vs autoloading
- 40:32Rails constant resolution
- 42:22Class reloading in dev
related talks
47mConstant autoloading in ruby on rails
42mZeitwerk: A new code loader
58mZeitwerk: A new code loader for Ruby
43mThe Magic of Rails
38mRails on Ruby: How Ruby Makes Rails Great
39mThe Rails Boot Process
57mFuture of Developer Acceleration with Rails
30mThe Rails Story: Two Decades of Design and Decisions
