I am using "acts_as_nested_set" in my rails app. (extended with awesome nested set plugin). I was trying to logic out the best way to write a function/method to clone an element and its entire nested set so that each element gets a clone but the relationship structure mimicks the original, just with the new elements.
With nested sets you get parent_id, lft, and rgt
positional columns... instead of just position_id
.
Should I start at the bottom (nodes with no children) of each set and clone up through the parents all the way to a new root?
This seems like either something that has been done or that there would be a method for doing this already for nested sets but I can't see to find anything to guide me.
Thanks