Skip to content
Enhances ActiveRecord with nested hierarchies.
Ruby
Failed to load latest commit information.
.github Updated GitHub issue and pull request templates. Mar 28, 2016
doc Added basic closure table documenation and diagrams. Nov 22, 2010
gemfiles Added Rails 4.2.x support. Dec 20, 2014
lib Refactored version label method name. Apr 2, 2016
spec
.gitignore Removed unnecessary exclusions from .gitignore. [ci skip] Oct 31, 2015
.rubocop.yml Updated Rubocop PercentLiteralDelimiters and AndOr styles. Apr 9, 2016
.rubocop_todo.yml Added Rubocop support. Oct 30, 2015
.ruby-version Updated to Ruby 2.3.1. Apr 28, 2016
.travis.yml Removed Ruby 2.1.x and 2.2.x support. Dec 25, 2015
CHANGELOG.md Added version release changes. Dec 2, 2015
CODE_OF_CONDUCT.md Updated to Code of Conduct, Version 1.4.0. Feb 13, 2016
CONTRIBUTING.md Fixed contributing guideline links. Feb 18, 2016
Gemfile Switched from HTTP to HTTPS when sourcing from RubyGems. [ci skip] Mar 17, 2013
Gemfile.lock Updated to Gemsmith 7.7.0. May 15, 2016
Guardfile
LICENSE.md Updated company links to be HTTPS instead of HTTP. [ci skip] Oct 25, 2014
README.md
Rakefile Updated Rubocop PercentLiteralDelimiters and AndOr styles. Apr 9, 2016
lineage.gemspec Updated to Gemsmith 7.7.0. May 15, 2016

README.md

Lineage

Gem Version Code Climate GPA Code Climate Coverage Gemnasium Status Travis CI Status Patreon

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:

Branch Graph

The page_branches table would consist of the following data:

Branch Table

Table of Contents

Features

  • Database integrity via the Closure Table pattern.

Requirements

  1. MRI 2.x.x.
  2. Ruby on Rails 4.x.x.

Setup

For a secure install, type the following from the command line (recommended):

gem cert --add <(curl --location --silent https://www.alchemists.io/gem-public.pem)
gem install lineage --trust-policy MediumSecurity

NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while allowing the installation of unsigned dependencies since they are beyond the scope of this gem.

For an insecure install, type the following (not recommended):

gem install lineage

Add the following to your Gemfile:

gem "lineage"

Usage

Add the following to any model you wish to enable with lineage support:

lineage

Tests

To test, run:

bundle exec rake

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
  • Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

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.

Contributions

Read CONTRIBUTING for details.

License

Copyright (c) 2010 Alchemists. Read the LICENSE for details.

History

Read the CHANGELOG for details. Built with Gemsmith.

Credits

Developed by Brooke Kuhlmann at Alchemists

Something went wrong with that request. Please try again.