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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89441a6c74647d292f5cc951eae24cfa?d=identicon&s=25 Jack Christensen (Guest)
on 2006-03-10 22:02
(Received via mailing list)
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
This topic is locked and can not be replied to.