A implementation of the Closure Table pattern for ActiveRecord models. This uses two tables to maintain the ancestor/descendant relationship for all branches of a particular model. For example, you might have web pages you want to represent in a nested hierarchy which would yield the following table structure:
- Page (i.e. pages)
- PageBranch (i.e. page_branches)
Assuming the following page hierarchy:
page_branches table would consist of the following data:
Table of Contents
- Code of Conduct
- Database integrity via the Closure Table pattern.
Type the following to install:
gem install lineage
Add the following to your Gemfile:
Add the following to any model you wish to enable with lineage support:
To test, run:
bundle exec rake
Read Semantic Versioning for details. Briefly, it means:
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
Code of Conduct
Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.
Read CONTRIBUTING for details.