Gem learn_rails shows you the ruby code behind rails magic.