Amazing nested set of plugins - how to add new children to the tree at different levels

Hi, I have a tree structure. I use the awesome nested set of plugins. how to add nodes to children at different levels. Please help me. I want to add, edit and delete nodes at all levels.

Can someone help me for the same thing?

+3
source share
1 answer

To add children, just 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 for managing the nested model in the source code of the plugin 1

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

+3
source

Source: https://habr.com/ru/post/1736768/


All Articles