Tory Long
2008-Mar-06 19:34 UTC
[Betternestedset-talk] Replicating a nested set structure to another model
Hi - first off BNS is awesome. We are using it extensively in our project and are very happy. What I am trying to accomplish is replicating a nested set structure from one model to another. Currently, to do this, I am rebuilding the tree structure entirely, as I am not able to simply copy nodes and their identity (parent_id, rgt, lft) based off the "template" nested set in the original model. This is very expensive code-wise, and the alternative (simply copying the lft/rgt/parent_id structure) would allow for what I need. BetterNestedSet enforces "move_to_child_of" and that seems to be the prohibiting factor from simply creating the new structure with parent_id/lft/rgt easily replicated through replicating or populating those fields to a similar structure as the original. Does anyone have a more graceful solution for this? While functional, rebuilding this structure with node-by-node traversal is not ideal. Thanks, Tory -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20080306/714ded68/attachment.html