How to make copy of tree node?

Hi guys,

I’m working with betternestedset and need to make copy of any node,
for example:

root
|_ Child 1
|_ Child 1.1
|_ Child 1.2
|_ Child 2
|_ Child 2.1
|_ Child 2.2

root2
|_ Child 1
|_ Child 1.1
|_ Child 1.2
|_ Child 2
|_ Child 2.1
|_ Child 2.2

And user should copy root2 and get the result like:
root
|_ Child 1
|_ Child 1.1
|_ Child 1.2
|_ Child 2
|_ Child 2.1
|_ Child 2.2

root2
|_ Child 1
|_ Child 1.1
|_ Child 1.2
|_ Child 2
|_ Child 2.1
|_ Child 2.2
copy of root2
|_ copy of Child 1
|_ copy of Child 1.1
|_ copy of Child 1.2
|_ copy of Child 2
|_ copy of Child 2.1
|_ copy of Child 2.2

Thanks for any help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs