Hey Conrad,
This should be documented better, but it is actually pretty easy.
1) run a migration to add lft and rgt as integer columns to your table
2) put acts_as_nested_set in your model
3) on script/console run YourModel.find(:first).renumber_full_tree
If you have multiple trees in your table, it is a little more
complicated. You first need to give each tree scope (add a tree_id
column) and then run the above method on a member of each tree.
If you want to go back to a plain old tree, all you need to do is run
the migration back down and remove acts_as_nested_set from your model.
Krishna
On 10/10/07, Conrad Chu <conradchu at conradchu.com>
wrote:> Hi,
>
> I currently am using acts_as_tree.
>
> I read in an old post (can''t recall which one) that it''s
somehow
> possible to convert the acts_as_tree by adding the lft and rgt
> columns and running a "method" to pre-populate them. Is that
even
> possible? If so, can some give me a clue as to how it''s done?
>
> Thanks!
> Conrad
> _______________________________________________
> Betternestedset-talk mailing list
> Betternestedset-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/betternestedset-talk
>