Book/Tutorial on Rails Internals?

I am looking for a book or tutorials that go more in depth on Rails internals.

Specifically, examining the source code of the Rails framework/active record/ action pack/etc.

I have read AWDR and Ruby For Rails. That plus being modest apps has helped provide a foundation.

While I know that reading the source code is the ideal way to learn and I have scanned some, I am not yet strong enough to be able to do so efficiently.

As such a book or a tutorial could help speed up my ability to understand the Rails source (for instance, the last chapter of Ruby for Rails).

Any pointers on-line or off would be appreciated.

Thanks,

John

I'm not sure if it's exactly what you're looking for, but "The Rails Way" by Obie Fernandez (http://www.informit.com/store/product.aspx? isbn=0321445619) is a great more in-depth look at rails & it's idioms.

I am looking for a book or tutorials that go more in depth on Rails internals.

Specifically, examining the source code of the Rails framework/active record/ action pack/etc.

I have read AWDR and Ruby For Rails. That plus being modest apps has helped provide a foundation.

While I know that reading the source code is the ideal way to learn
and I have scanned some, I am not yet strong enough to be able to do so efficiently.

As such a book or a tutorial could help speed up my ability to understand the Rails source (for instance, the last chapter of Ruby
for Rails).

I don't know of any such book, but a big problem with it would that it
would very quickly become obsolete. Books etc... have enough trouble
staying on top of the externally visible (ie api etc...) changes, and
internal changes happen even more often. You can learn a lot though by
just stepping through it with a debugger (or just mentally, assuming
you can keep in your head enough of the current state). Pick some
specific bit of functionality and follow it all the way through. It
should get easier as you get more familiar with the source.

Fred

+1 to the other two replies.

I've done talks about Rails internals for 1.1 and 2.x and they were based on code walkthroughs on some particular revision and help from rails-core to understand why some things were done that way. The last one from November 2007 is online:

     http://www.hashref.com/talks/rails-desde-el-codigo-2007/index.html

It's Spanish but it is mostly code.

-- fxn

Hi --

I am looking for a book or tutorials that go more in depth on Rails internals.

Specifically, examining the source code of the Rails framework/active record/ action pack/etc.

I have read AWDR and Ruby For Rails. That plus being modest apps has helped provide a foundation.

While I know that reading the source code is the ideal way to learn and I have scanned some, I am not yet strong enough to be able to do so efficiently.

As such a book or a tutorial could help speed up my ability to understand the Rails source (for instance, the last chapter of Ruby for Rails).

I don't know of any such book, but a big problem with it would that it would very quickly become obsolete. Books etc... have enough trouble staying on top of the externally visible (ie api etc...) changes, and internal changes happen even more often. You can learn a lot though by just stepping through it with a debugger (or just mentally, assuming you can keep in your head enough of the current state). Pick some specific bit of functionality and follow it all the way through. It should get easier as you get more familiar with the source.

That's what I did in that last chapter -- basically stalking #belongs_to through the source code. The source definitely does change a lot over time, so mainly one wants to learn techniques for how to navigate it, rather than trying to master or memorize every particular of it. (At least, my brain is better at the learning to navigate thing :slight_smile: It can be daunting but with a little guidance people usually end up discovering that lots of it is much more accessible than they'd thought.

David

Jamis Buck has dissected a number of Rails components over on his blog at http://www.jamisbuck.org/.

Specifically I know his routing walkthrough was really good.

--Jeremy

As a follow up, I have been reading Russ Olsen's "Design Patterns in Ruby" and am learning a lot from it.

For Rails specifically, there is 1 chapter that explains how the adapter pattern can be used to enhance convention over configuration.

It is very helpful and exciting to use debugger such as 'ruby-debug' when you read through the source codes.

Using the debugger, when reached a debug point you set, rails execution pauses and you can see what value each variable has, how the frame stack is, etc.

To do that, in Rails 2.0.2, just write 'debugger' in your source code wherever you want to insert a break point, then start the web server with 'script/server -u'

In Rails 1.2.x, you also have to write require 'ruby-debug' at the end of config/environments/development.rb while starting the web server with 'script/server'

Good luck!

Thanks :slight_smile:

-Thufir

Are you already done learning ruby first ?