On Sep 13, 2009, at 4:37 AM, Chris Hoeppner wrote:
> > Hey, > > I'm building a small wiki "engine" using DataMapper to handle the > persistence. Let me explain my layout, and the riddle I encountered: > > * Everything is a Page. > * Pages can have many childs, but only one parent. > * Pages with the same parent need to have distinct labels (titles, > names...) > > My first thought was adding :key => true to parent_id and label, but > the > next second I thought that why I'd have all this as PK. Also, it would > force me to have *every* page parented somewhere. I could of course > add > a Page called Wiki as root, or have root Pages come with a parent_id > of > zero... > > This is where I thought I'd ask a bit around. I'm sure you DM wizards > will have a magic answer, or at least a hint in the right direction. > Maybe change the third requirement to be: * Pages must have distinct labels (titles, names...) then make the labels unique. For a wiki, I'd also question your second requirement. IMO, pages should have n:n relationships. HTH, Roy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
