Forum: Ruby on Rails Data modeling - representing data across models

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jack C. (Guest)
on 2006-03-10 23:02
(Received via mailing list)
I'm having some difficulty deciding where to put logic that crosses

For example, given models people, departments, work schedules, and

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
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?


Jack C.
This topic is locked and can not be replied to.