ClosureTree/closure_tree: Easily and efficiently make your ActiveRecord models support hierarchies
12-Jun-2025 40
Dramatically more performant than ancestry and acts_as_tree, and even more awesome than awesome_nested_set, closure_tree has some great features:
Best-in-class select performance:
Fetch your whole ancestor lineage in 1 SELECT.
Grab all your descendants in 1 SELECT.
Get all your siblings in 1 SELECT.
Fetch all descendants as a nested hash in 1 SELECT.
Find a node by ancestry path in 1 SELECT.
Best-in-class mutation performance:
2 SQL INSERTs on node creation
3 SQL INSERT/UPDATEs on node reparenting.
ClosureTree/closure_tree: Easily and efficiently make your ActiveRecord models support hierarchies #ruby #rubydeveloper #rubyonrails #ClosureTree/closure_tree: #Easily #efficiently #ActiveRecord #models #support #hierarchies #activerecord https://www.rubyonrails.ba/link/closuretree-closure_tree-easily-and-efficiently-make-your-activerecord-models-support-hierarchies