Skip to content
CAI
Software that uses CAICheck a score

madeintandem/jsonb_accessor

61.1

Adequate · 20 September 2026

413

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Ruby gem that provides JSONB accessor functionality for ActiveRecord models, allowing developers to define typed virtual attributes backed by PostgreSQL JSONB columns. It supports complex querying through generated scopes, handles type casting and default values, and ensures compatibility with modern Rails versions and JRuby.

Features

Initial database schema and configuration for PostgreSQL

The database layer now includes a \config.yml\ file for PostgreSQL connection settings, allowing the host and username to be configured via environment variables (\DATABASE\_HOST\, \DATABASE\_USER\), and a \schema.rb\ file defining the initial database structure. This schema creates \products\ and \product\_categories\ tables, utilizing JSONB columns (\options\, \data\) alongside standard types to support the library's core functionality.

db · high confidence

Behavioural changes

Added database migration for testing schema

A new migration file (20150407031737\_set\_up\_testing\_db.rb) was added to define the schema for the testing database environment. This migration creates two tables: 'products', which includes columns for JSONB data (options, data), various standard types (string, integer, boolean, float, time, date, datetime, decimal), and a foreign key reference (product\_category\_id); and 'product\_categories', which includes a JSONB 'options' column. The migration is explicitly scoped to ActiveRecord 5.0.

db/migrate · high confidence

Console and setup scripts updated for modern Rails conventions

The development console (bin/console) now automatically loads the test database configuration and the spec helper, providing immediate access to the Product class and RSpec without manual setup, while removing the previous dependency on Pry plugins. The setup script (bin/setup) has been streamlined to use the modern 'bundle' command instead of 'bundle install' and now explicitly runs 'rake db:create' and 'rake db:migrate' to ensure the database is ready for use.

bin · high confidence

Refactored query scopes and added Rails 7.1 compatibility check

The gem's query interface has been restructured: the low-level query logic is now centralized in \QueryBuilder\ and \QueryHelper\, which define scopes like \jsonb\_where\, \jsonb\_where\_not\, \jsonb\_order\, and numeric/time-specific comparators. The \Macro\ module now delegates scope definition to a new \AttributeQueryMethods\ class, ensuring that per-attribute scopes (e.g., \\<attribute\>\_where\) correctly inherit store-key mappings from parent classes. Additionally, a \enum\_support?\ check was added to the version module to detect Rails 7.1+, where enums require database columns, allowing the gem to adapt its behavior accordingly.

_lib/jsonb\accessor · high confidence

Fixes

Fix regression in default values for sparse JSONB records

This release fixes a bug where persisted records with sparse JSONB data (missing fields) incorrectly returned \nil\ instead of their declared default values. The issue was introduced in version 1.4.1 during a refactor that added \prefix\ and \suffix\ support for attribute names; the change inadvertently mutated the options hash, stripping the default value from the virtual attribute definition. Additionally, the gem now documents the backward-compatible positional hash syntax for \jsonb\_accessor\ definitions.

(repo-wide) · high confidence

Test coverage

Added performance benchmarking and expanded test coverage for jsonb\_accessor; Added tests for JSONB accessor query helpers and builders.

Dependencies

Drops Ruby \<3 and ActiveRecord \<6.1 support, adds JRuby compatibility

The gem now requires Ruby 3 or higher and ActiveRecord 6.1 or higher, removing support for older versions. It adds explicit support for JRuby by conditionally depending on the activerecord-jdbcpostgresql-adapter. Development dependencies have been updated to newer versions (e.g., RSpec, Rubocop, DatabaseCleaner), and the gemspec now excludes PNG files from the bundle.

(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 61.

Lenses

  • Code Health 96
  • Architecture 69
  • Maturity 50
  • Readiness 66
  • Security 78

Changes since last survey

  • 300 commits — 270 feature/other, 30 fixes

By area

  • (root) — 131 commits
  • lib/jsonb_accessor — 63 commits
  • (repo) — 42 commits
  • .github/workflows — 33 commits
  • spec/jsonb_accessor_spec.rb — 10 commits
  • spec/spec_helper.rb — 5 commits
  • db/schema.rb — 4 commits
  • gemfiles/activerecord_5.0.0.gemfile.lock — 4 commits
  • spec/jsonb_accessor_performance_spec.rb — 4 commits
  • .github/dependabot.yml — 1 commit
  • bin/console — 1 commit
  • db/config.yml — 1 commit
  • spec/lib — 1 commit

Notable commits

  • fix: Fix Travis badge
  • fix: Fix deprecation error
  • fix: Fix keyword param deprecation warning in Ruby 2.7
  • fix: Fix performance issues with how jsonb_accessor clears dirty tracking
  • fix: Fix timezone issues with datetime type
  • fix: Improved docker compose file and database config. Also upgraded Rubocop and fixed lint issues.
  • fix: Merge branch 'master' into fix-travis-build
  • fix: Merge branch 'master' of https://github.com/madeintandem/jsonb_accessor into fix-timezone-issues
  • fix: Merge branch 'master' of https://github.com/madeintandem/jsonb_accessor into fix-timezone-issues
  • fix: Merge pull request #114 from madeintandem/fix-travis-build
  • fix: Merge pull request #116 from benningm/fix-scope-warnings
  • fix: Merge pull request #134 from madeintandem/bugfix/direct-assignment-with-store-keys
  • fix: Merge pull request #137 from caiohsramos/fix-timezone-issues
  • fix: Merge pull request #149 from madeintandem/bugfix/non-jsonb-accessor-attributes
  • fix: Merge pull request #155 from madeintandem/bugfix/deserialization-of-datetime
  • fix: Merge pull request #169 from bekicot/rails-fix
  • fix: Merge pull request #77 from oliverx0/fix-after-initialize
  • fix: Revert "Added DevMynd logo to readme"
  • fix: Revert "Adding logo to readme"
  • fix: bugfix: prevent ActiveModel::MissingAttributeError
  • …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

madeintandem/jsonb_accessor 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 20 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 cef7a810a48ce9c3b8a79015591fddfb1a963e5a — 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-b51f968c9b10.