Now that we’ve upgraded to rails 2.1, I have a handy new activerecord tool called Dirty that tracks unsaved attribute changes.
Rather than the code below:
newscoretype = 1
oldscoretype = score.scoretype_id
if oldscoretype == newscoretype...
I can instead write:
if score.scoretype_id_changed?...
I still have easy access to the old value using _was
oldscoretype = score.scoretype_id_was
There are also methods that query the dirty state of the whole model, e.g. score.changed?
Love it.
September 19th, 2008

Over the weekend, I knew we’d be without cable so I downloaded Dr. Horrible to my ipod. Instead of reading our Mad Magazines before bed, my husband and I checked out this new Sing-Along-Blog.
Now, I’m an ex-musical theatre professional and I’ve been a Neil Patrick Harris fan since his work with Stephen Sondheim. While I don’t really watch How I Met Your Mother because the other characters are trite and annoying, I LOVED Neil’s cameo in Harold and Kumar. Yeah, he was okay in Doogie Howser M.D. too.
Anyway, this show is fantastic. The singing is just okay (especially some of the minor characters are really weak) but the score is great and the concept/book is really fun.
Oh Joss, when can I get more?
September 9th, 2008