Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone tree #197

Open
pecha7x opened this issue Jul 30, 2014 · 0 comments
Open

Clone tree #197

pecha7x opened this issue Jul 30, 2014 · 0 comments

Comments

@pecha7x
Copy link

pecha7x commented Jul 30, 2014

Hi, please any tip about as can clone all tree.
I try -
def clone_item(root, items)
childrens.each do |child|
new_child = child.dup
new_child.parent_id = root.id
new_child.save
clone_item(new_child, child.children) if child.has_children?
end
end

but a new tree incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant