This is a pretty good bite-size sampling of the workings of some of the nice things we take for granted in Rails (like AREL). Rspec is another one that's worth looking into:
http://stackoverflow.com/questions/3105755/ruby-metaprogramm...
http://stackoverflow.com/questions/3105755/ruby-metaprogramm...