I've just started using $acts_as = nested_set on a model, and notice that my lft values are now negitive.
Do we have any functions in Akelos to REBUILD the tree using only parent_ids? I'm looking for a function to 'clean up' the table if something nasty happens like a node is deleted improperly.
The clean_up function would rebuild the tree using only the parent_id field. There's a PHP function here http://articles.sitepoint.com/print/hierarchical-data-database which will build the tree, but you must start with a root node. My setup has multiple root nodes. :)
Thanks for any help!
CommentAuthorsuthern
and that is exactly what I did.
I built a function to first find the min(lft), then update all lft and rgt values UP by that number. Now the min is 1. Next, I run getRoots(), then do a loop, and send each root's name to a modified version of the function at the link above.
If you need clarification, reply and I'll try to to be a bit more clear. :)
CommentAuthorsuthern
and now I do something even simpler. I just set all lft and rgt values to 0, then grab all the roots (that have a parent_id IS NULL or parent_id = 0), and feed em thru the function listed in the top post.