Acts_as_tree circular reference


#1

my application is using acts_as_tree to create a directed graph.

Everyone would work fine, except that nothing prevents the user to
create a circular reference:

item.parent=child
item.save
=> true

child.parent=item
child.save
=> true

I checked in the database, and there it is: an item that has as parent
its own child!

item.parent_id = child_id

I know I could add code to prevent this from happening, but shouldn’t
that be the job of acts_as_tree ?