views:

105

answers:

1

Hi I have a tree structure.. I am using Awesome nested set plugin. how to add nodes to the children at various levels. Please help me. I want to add ,edit and delete nodes at any levels.

Can anyone help me for the same?

+1  A: 

To add a children simply call

item.children.create(:name => "new item")

or

new_item = Item.new(:name => "new item")
item.children << new_item

You can find all the methods to manipulate the nested model at the plugin source code 1

http://github.com/collectiveidea/awesome_nested_set/blob/master/lib/awesome_nested_set.rb

Horacio