# stefankroes/ancestry

Organise ActiveRecord model into a tree structure

Repository: https://github.com/stefankroes/ancestry
Canonical: https://ross.abutalabs.com/products/ancestry
Language: Ruby
License: MIT
License Family: permissive
Last push: 2026-06-25T00:51:43+00:00

## Health v2 (maintenance only)
Score: 72/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 89, release rhythm 35, longevity 100
- inputs: {"age_days": 6165, "days_push": 70, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3880, forks 473 (observed 2026-08-28T04:08:28.013011+00:00)

## What it is
A Ruby gem that organizes Rails ActiveRecord models into tree (hierarchical) structures using the materialized path pattern. It stores the ancestor chain in a single column, enabling efficient single-query traversal of ancestors, descendants, siblings, and children without extra tables.

## Use cases
- organize ActiveRecord models into a tree hierarchy
- query ancestors and descendants of a record efficiently
- build category or comment nesting in Rails
- manage parent-child relationships in a single database table
- move nodes in a hierarchy without rewriting the whole tree
- add depth caching and counter caches to hierarchical data

## When to choose
- you use Rails/ActiveRecord and need hierarchical data in an existing table
- you want fast single-query tree reads with a btree index
- you want to avoid extra join tables for tree storage
- you need STI support or orphan-handling strategies for tree nodes

## When to avoid
- you use a non-Ruby ORM or non-ActiveRecord stack
- you need graph structures with many-to-many relationships rather than trees
- you prefer adjacency-list or nested-set patterns with existing tooling
- your project does not use a relational database supported by ActiveRecord

## Facets
- artifact type: library
- maturity: stable
- function: orm, database, developer-tools
- domain: databases, web-development, backend, developer-tools
- platform: ruby, jvm
- tags: activerecord, rails, tree-structure, hierarchy, materialized-path, gem

## Member repositories
- stefankroes/ancestry (main) score 72

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:28.013011+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:25:43.618999+00:00, confidence not recorded.
  - readme: https://github.com/stefankroes/ancestry (fetched 2026-08-28T04:08:28.013011+00:00, sha c48c5956249f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
