awesome_nested_set
RecommendedAn awesome nested set implementation for Active Record
Save 36% for Black Friday! Save 36% on GoRails for Black Friday! Learn more
An awesome nested set implementation for Active Record
Ancestry allows the records of a ActiveRecord model to be organized in a tree structure, using the materialized path pattern. It exposes the standard relations (ancestors, parent, root, children, siblings, descendants) and allows them to be fetched in a single query. Additional features include named scopes, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records.
Easily and efficiently make your ActiveRecord model support hierarchies
A gem that adds simple support for organizing ActiveRecord models into parent–children relationships.