collectiveidea/awesome_nested_set
58.5
Adequate · 19 September 2026
1.2k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is the Awesome Nested Set gem, a Ruby library that manages hierarchical tree structures within ActiveRecord models using the nested set pattern. It provides core capabilities for creating, moving, pruning, and validating nodes in a tree hierarchy, ensuring data integrity through transactional operations and retry logic for database conflicts. The library is designed for broad compatibility, supporting Rails versions from 5.2 to 8.1 and multiple database adapters including PostgreSQL, MySQL, and Oracle.
How it got here
2007 — Rails 8.1 support and infrastructure modernization
7 changes.
The project modernized its gem infrastructure to support Rails 8.1, replacing legacy Rake and Test::Unit tasks with Bundler and RSpec 3. It refactored the library into a modular structure, removed obsolete view helpers, and significantly expanded the test suite to cover multiple database adapters and edge cases.
2008–2011 — Dependency updates and test coverage
4 changes.
This period focused on updating the Awesome Nested Set library to version 3.9.0 to address ordering issues and ensure compatibility with newer Rails versions. The work also involved establishing the project's gemspec and development dependencies, alongside expanding test coverage by adding support models and verifying the nested\_set\_options helper.
2013–2021 — Modular refactoring and Rails compatibility
4 changes.
The nested set model logic was refactored into distinct behavioral modules to improve maintainability and align deletion and movement operations with Rails standards. Comprehensive test coverage was added for hierarchical operations and transaction retry logic to ensure reliability. Support was expanded to include testing across a wide range of Rails versions from 5.2 to 8.1.
Removals
Removed unused Rake task file
The unused \awesome\_nested\_set\_tasks.rake\ file has been deleted from the project, cleaning up the task directory.
tasks · high confidence
Behavioural changes
Modernize gem infrastructure and add Rails 8.1 support
The gem now supports Rails 8.1, extending compatibility to the latest framework versions (up to 8.1.0) alongside Rails 7.2, 7.1, 7.0, 6.1, 6.0, and 5.2. To facilitate testing across these versions, the project has adopted the Appraisals tool, which defines specific Gemfiles for each supported Rails version and includes necessary dependencies for Rails 7.0. The build and release infrastructure has been updated to use Bundler for gem helper tasks and RSpec for testing, replacing the previous Rake-based test and RDoc generation tasks. Additionally, legacy Rails plugin hooks (init.rb, install.rb, uninstall.rb) have been removed, and the project now uses a standard Gemfile.lock ignore pattern in .gitignore.
(repo-wide) · high confidence
Refactored nested set model into modular behavior components
The nested set model logic has been reorganized into distinct modules (Movable, Prunable, Rebuildable, Relatable, Transactable, Validatable) to improve code clarity and maintainability. This refactoring introduces specific behavioral changes: moving nodes now supports \:root\ as a target for \move\_to\_child\_of\, and \move\_to\_child\_with\_index\ now correctly handles moving nodes to specific positions within a sibling list. Deletion behavior for \dependent: :restrict\_with\_error\ and \dependent: :restrict\_with\_exception\ has been aligned with Rails standards, ensuring proper error handling and transaction abortion. Additionally, the \scope\_for\_rebuild\ method now correctly handles NULL values in scope columns using SQL \IS NULL\ comparisons, and the \rebuild!\ process maintains consistent ordering by primary key.
_lib/awesome\_nested\set/model · high confidence
Removal of legacy view helpers and migration to modular structure
The \awesome\_nested\_set\_helper.rb\ file, which provided view helpers like \nested\_set\_options\_for\_select\ for generating select options from nested set trees, has been removed. The main library file (\awesome\_nested\_set.rb\) has been refactored to use a modular structure, requiring \awesome\_nested\_set/awesome\_nested\_set\ and utilizing \ActiveSupport.on\_load\ for injection, replacing the previous inline module definitions. This change removes the automatic inclusion of view helpers in all views and updates the internal architecture to align with modern Rails patterns.
lib · high confidence
Test coverage
Added test coverage for User model hierarchical operations; Added test fixtures for nested set models and behaviors; Added test support models for nested set scenarios; Added tests for the nested\_set\_options helper; Added tests for transaction retry logic; Expanded test database schema and configuration for comprehensive coverage; Migrate test suite from RSpec 2 to RSpec 3 and modernize test infrastructure; Removed placeholder unit test file.
Dependencies
Awesome Nested Set library updated to version 3.9.0
The awesome\_nested\_set gem has been updated to version 3.9.0. This release includes various fixes and improvements to the nested set functionality, such as handling nil left/right values, fixing ordering issues, and ensuring compatibility with newer Rails versions. The library continues to provide efficient tree structure management for ActiveRecord models.
_lib/awesome\_nested\set · high confidence
Expanded Rails version support via new Appraisal gemfiles
The gemfiles directory now includes dedicated Appraisal configurations for Rails 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0, and 8.1, enabling the library to be tested and used across these specific framework versions. The Rails 7.0 gemfile explicitly adds dependencies for base64, bigdecimal, drb, and mutex\_m, while the other versions rely on the gemspec for core dependencies and specify compatible database adapters (sqlite3, mysql2, pg).
gemfiles · high confidence
Initial gem specification and development dependencies
The project introduces its primary gemspec and Gemfile, defining the library as 'awesome\_nested\_set' with a runtime dependency on ActiveRecord versions 4.0.0 through 8.1.x. Development dependencies are established for testing and appraisal, including rspec-rails (4.0.0 to \<8.0), database\_cleaner, and rake (\~\> 13), while specifying a minimum Ruby version of 2.0.0.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 59.
Lenses
- Code Health 100
- Architecture 69
- Maturity 50
- Readiness 55
- Security 78
Changes since last survey
- 300 commits — 251 feature/other, 49 fixes
By area
- (root) — 127 commits
- lib/awesome_nested_set — 81 commits
- (repo) — 68 commits
- spec/awesome_nested_set_spec.rb — 6 commits
- .github/workflows — 5 commits
- certs/parndt.pem — 2 commits
- spec/models — 2 commits
- spec/spec_helper.rb — 2 commits
- spec/support — 2 commits
- .github/FUNDING.yml — 1 commit
- .github/stale.yml — 1 commit
- lib/awesome_nested_set.rb — 1 commit
- spec/db — 1 commit
- spec/fixtures — 1 commit
Notable commits
- fix: 2-1-stable: fix ActiveRecord::StatementInvalid: Error: Column 'lft' in order clause is ambiguous
- fix: 2-1-stable: fix deleting a parent may lead to a stale object error
- fix: Add Ruby 3.4 consistently and fix excludes (#498)
- fix: FIx for ambiguous order for children
- fix: Fix .all_roots_valid? method when model is ordered by default
- fix: Fix Github workflow (#457)
- fix: Fix README migration syntax
- fix: Fix bug in Rakefile
- fix: Fix bug: when model with default_scope make #lft and #rgt wrong
- fix: Fix counter_cache to update after move
- fix: Fix dependent nullify for custom parent_column
- fix: Fix deprecation warnings on Rails 5.2
- fix: Fix for dependent: :restrict_with_exception which never deletes but returns without error if no descendants are found.
- fix: Fix for mssql with jruby/activerecord-jdbc-adapter
- fix: Fix frozen string literal warning in scope_for_rebuild
- fix: Fix link to compare view for 3.4.0
- fix: Fix migration in README.md
- fix: Fix move_to_root functionality which Fixes #117 and Fixes #90
- fix: Fix rebuild! to use parent_id instead of id
- fix: Fix sourcecode documentation typos (#416)
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
collectiveidea/awesome_nested_set was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 7a642749af74519b4bf3642d939061beb36835e1 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.