Jack Christensen
2006-Mar-10 21:00 UTC
[Rails] Data modeling - representing data across models
I''m having some difficulty deciding where to put logic that crosses models. For example, given models people, departments, work schedules, and weeks. Where would the following best fit: who is scheduled to work in a given department in a given week? how many hours is a given person scheduled in a given week? how many hours is a given person scheduled in a department in given week? how many hours total are scheduled in a week? The first three could possibly go in department or person, but doesn''t feel exactly right. Especially because I have a lot of these type problems and filling Person with methods like num_hours_scheduled_by_department_and_week( department, week ) seems rather messy. The last doesn''t seem to fit in any existing model. I guess the question boils down to where do you represent data that is the intersection or composite of multiple models? Thanks. -- Jack Christensen jackc@hylesanderson.edu