I have a fairly straightforward modeling task involving People,
Albums, and Photos. Here are the business rules:

*One person can have many photos.
*One album can have many photos.
*One album can have photos of many people.
*An album can have multiple photos belonging to the same person, but
not necessarily all the photos belonging to that person.
*Given an album, I would like some way to aggregate sets of photos by
the person they belong to (where each set is a subset of all the
photos that person has). So for example, I would like to say that in
Album 10, Bobby has his photos 9, 17, and 41 and Sally has her photos
47, 57, 93, 201, 203. Of course, Bobby and Sally both have a lot more
photos than that but just not in this album.

I would think the tables would look like this:

Person
id | name

Album
id | name

Photo
id | filename

PersonAlbumPhoto
person_id | album_id | photo_id

My questions are these:

*Is this a reasonable model for the business rules as I described? I
am happy to hear of something more elegant or efficient.
*How should I model my Ruby classes for Person, Album, and Photo to
generate what I need?

Thanks for the insight.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to