An awesome nested set implementation for Active Record
Ancestry allows the records of a ActiveRecord model to be organized in a tree structure, using a single, intuitively formatted database column. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are 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
Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.