Topic: Help Designing Calendar/Events Model
I have an application where I need to track certain events in a basic calendar. Right now I only have a CourtDate model with these attributes: date, time, matter_id, court_date_type_id. So right now, when I need to find all court dates for a particular day I do CourtDate.find(:all, :conditions => ['date = ?', Date.today])
I need to add the ability to track other events such as meetings and appointments and display them all on the same calendar page. There are 3 different types of events that I know of at this point: court dates, meetings, and consultations. I would like to be able to add other event types if necessary in the future, and these other event types may have additional attributes to track.
I was thinking of adding an Event model that has: date, start_time, end_time, duration, notes, and description - and then subclass the CourtDate model from the Event model since a court date event has other properties not in other events like 1) court date type; and 2) case it pertains to (matter_id).
What are your thoughts? How would you model this? STI, polymorphic, something else? I need to be able to find all Events on a single day/week/month or only certain types of Events on a day/week/month.