Hi,
I’m interested to know if anyone has any clever suggestions about how
to model the following scenario with ActiveRecord:
- I’d like a collection of media, including photos, videos, and songs,
all of which have some common and unique properties - I start with a “media” table, that includes things like id, creation
date, name, description, and filename - the media table also has a media_type_id that maps to another table,
media_types, that has IDs for each of the three types of media - then there are tables for each specific media type, so the photos
table has photographer_name, subject_name, etc; the videos table has
duration, format, etc; and the songs table has artist, duration, etc - each of the specific tables also has an ID column; a media_detail_id
column in the media table maps to this ID
My ultimate goal is for a URL like /media/index to display all the
media names, and clicking on one gives the detail depending on what
kind it is. Another goal is to be able to enter all the data for,
say, a photo on one page – both the attributes for the media table
(name, description) and for the photos table (photographer name,
subject name).
I’ve been trying to work with Rails to do this simply, and it’s clear
I’m fighting against the grain of how it likes to do things. If
anyone has any suggestions, they’d be much appreciated.
Thanks,
Dan