Rails Architecture

Having spent some time studying Ruby, I became interested in knowing how it is used to build a domain language like Rails; this meant of course understanding how Rails actually works.

Surprisingly, I found in the web very little interest on this subject, aside from an excellent chapter by D.Black (Ruby for Rails, ch 17, "Techniques for exploring the Rails source code"). The general actitude is summed up by this intriguing passage in the Agile Rails book:

How does the template get hold of controller private data? The answer is both simple and subtle. Rails does some Ruby magic with instance variables... but some folks press the point: "just how do these variables get set?" These folks clearly don’t believe in magic. Avoid spending Christmas with them.
The humour is brilliant, but it leaves a strange taste; one wonders if, when other revolutionary technologies emerged, authors had said: "..Unix redirection applies some magic to file descriptors... Tcp performs some magic to evaluate the network delay.."?

However, it is open software; we can just read and study it. Not an easy experience (Rails seems to be to current systems what quantum-mechanic was to traditional physics), but extraordinarily interesting. I begin to document (Sept 2007) here my findings.

I start from some of Rails accessors, which will seem a bit dry subject, but that are essential to understand details later (for example, the class_inheritable_accessor is essential to understand what the Controller does at startup).
I continue with a (partially animated) series of block diagrams of the Controller-View organization.



[URL: ; Last updated: ]