On 19/03/2012, at 6:55 AM, Neil Chaudhuri wrote: > Person > has n, :photos > > Album > has n, :photos, :through => Resource > has n, :people, :through => :photos, :via => :person > > Photo > belongs_to :person, :required => true > has n, :albums, :through => Resource
Neil, Your Resource table has a photo_id and an album_id. You will need two indices to traverse this efficiently in both directions, one with the pair (photo_id, album_id) and one the other way around. But that doesn't solve your basic problem. You have Person -< Photo -< Resource >- Album You're trying to make a :through relationship that goes through 3 links from Album to Person. Not sue, but I don't think this is going to work. > Given an album, I would like all the photos in that album grouped by > the person they belong to. You have no index that contains a (album, person) pair, so that grouping is going to have to occur after retrieval. Clifford Heath. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
