STI to the rescue

I got a little sidetracked watching Scrooged, but I was able to lay some more foundation for Nanned.My initial idea was to create a table for each item type (movie, book, game) and then link them to the user table via a library table. Unfortunately, this proved harder than I thought. I couldn’t find the right RoR magic to make the Library model get the right info. So I gave up and watched some more Scrooged, and then it hit me: Single Table Inheritance.Rails has a really nice and easy implementation of STI, and it seemed to fit well, so I gave it a shot. Sure enough, easy-peasy one two three-sy. The only problem I’m having now is that accessing the join table is a little awkward:

>> u = User.find(1)=>

I just don’t like the u.medias part, but I think I can fix it by renaming the table to Media, and then specifying that table name in the Media model.