datamapper / dm-is-tree

DataMapper plugin allowing the creation of tree structures from data models
http://datamapper.org/
MIT License
21 stars 8 forks source link

Constraints? #7

Open mltsy opened 12 years ago

mltsy commented 12 years ago

It would be awesome if dm-is-tree was compatible with dm-constraints! I was able to add a constraint to protect nodes with children by repeating the children relationship like this:

is :tree
has n, :children, :model => self, :child_key => :parent_id, :constraint => :protect

However, it would be much more convenient if one could simply say:

is :tree, :constraint => :protect