Book Review: Pro Active Record

Posted by Rick DeNatale Tue, 30 Oct 2007 16:31:00 GMT

I've been meaning to write a review of the recently published Apress book "Pro Active Record" by Kevin Marshall, Chad Pytel, and Jon Yurek for a while now. I have to admit that I was prompted to sit down and actually do it after reading Josh Susser's recent review of the same book.

While I generally agree with Josh's assessment, We do differ a bit on which audience the book best serves.

The goal of the book is to cover Active Record in depth, outside of the context of Rails. The result, as I see it, is a book which is useful to intermediate to advanced users of Active Record, those who want to dig in to understanding the implementation and perhaps extending it.

My own reading of the book gave me the impetus to explore the code of Active Record to the extent where I felt comfortable submitting contributions to Rails. Since reading the book, I've written and submitted two active record patches to the Rails Trac. The first fixed an oversight which made the schema.db file dumped for MySQL tables with non-standard primary keys to lack those primary key declarations, and the second is an enhancement which allows the :joins option of methods like find and count in ActiveRecord::Base to take values like the :include option as an alternative to a sql joins clause string. Both have made it into rails edge!

Read more...

Posted in ,  | Tags  | no comments | no trackbacks

Active Record and Referential Integrity

Posted by Rick DeNatale Sat, 14 Jul 2007 19:10:00 GMT

Josh Susser just posted a new Rails plugin which adds a validates_existence_of method to ActiveRecord::Base.. The idea is that beyond validates_presence_of, which simply checks that a foreign key field is non-nil, or validates_associated which validates the model referenced by a foreign key, validate_existence ensures that the referenced model exists in the database, no more no less.

It’s brand new, but it sure looks like a nice idea.

Posted in  | Tags ,  | no comments | no trackbacks