Rebuilding Rails - Understand Rails by Building a Ruby Web Framework
With Rebuilding Rails you’ll build a complete Ruby MVC framework from an empty directory. Your framework will be structured like Rails, using the same architecture and the same metaprogramming tricks. You’ll learn the magic behind Rails. You’ll finish each system and solidify your knowledge with structured exercises. And you’ll get the gut-level understanding that only a framework builder has.
Source: Rebuilding Rails - Understand Rails by Building a Ruby Web Framework