Skip to content
CAI
Software that uses CAICheck a score

madeintandem/jsonb_accessor

57.5

Adequate · 6 November 2026

413

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 58 → 58 (-0.4)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 74 → 74 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 44 → 44 (+0.0)
  • Readiness 68 → 68 (+0.1)
  • Security 82 → 73 (-9.0)

Resolved (2)

  • Off-boarding risk: anonymized user #1
  • Outdated: pry

New (1)

  • Off-boarding risk: anonymized user #1

Written by cca.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 6 November 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.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.