Rails Router: How it Do

Anything becomes interesting if you look at it long enough

-Gustave Flaubert

I recently decided that I would spend some time investigating how the Rails Router works. I figured I’d read some source code, scan some documentation, and then move on with my life, having gained a slightly better understanding of this chunk of Rails I take for granted.


Turns out, the deeper you go with this, the more interesting it gets.  Fast forward a week, and I’m reading books about tokenization, spending my spare time pondering parsing, and watching YouTube videos about constructing Deterministic Finite Automata.  Much more challenging and enthralling than I originally anticipated.

If you don’t have a CS background, those terms may seem completely foreign.  Don’t worry, they were gibberish to me as well.  I’m going to do my best to explain the basic concepts and hopefully we can all learn something together.

Keep reading