Picture of jgehtland

Upgrades for ActiveRecord

  • Posted By Justin Gehtland on April 03, 2008

Ryan has been writing about what’s new in ActiveRecord. I love these new additions to the framework. The ability to track modified properties out of the box has been necessary for a while, and though I’m a fan of acts_as_audited, these changes will essentially obviate it and replace it with a before_save hook (don’t forget your transactions!).

I’m excited to see the partial- (and no-) update support as well. This should save tons of unneccessary write operations on unmodified objects. I’ve never been too concerned about the need for eliminating unchanged columns from a write operation, as long as there were some modifications, as we tend not to create objects so big or tables so wide that the performance gain is obvious. The suppression of completely unnecessary writes, though, is huge. I’m glad to see the changes made to the framework, though, because these are real performance gains, essentially for free if you move up to edge.

Comments
  1. MichaelApril 03, 2008 @ 01:14 PM

    I disagree that this edge feature will obviate acts_as_audited. Acts_as_audited allows you to view the entire history of an audited model. The edge features do not.

  2. jgehtlandApril 03, 2008 @ 10:05 PM

    Michael—

    That’s what I meant by saying you could replace it with a relatively simple before_save hook. The complexity of acts_as_audited is mostly around tracking and saving changes to attributes. That now becomes simple; a simple model for storing those changes is about all you’d need to meet the 90% case of acts_as_audited.

    At the very least, the codebase for acts_as_audited can become a lot smaller. ;-)