Reputation: 3181
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?
Upvotes: 3
Views: 1221
Reputation: 2765
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
Upvotes: 3