Skip to content
CAI
Software that uses CAICheck a score

GeorgeKaraszi/ActiveRecordExtended

68.1

Adequate · 19 September 2026

1.7k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

ActiveRecordExtended is a Ruby gem that extends ActiveRecord with advanced query capabilities for PostgreSQL, including support for unions, common table expressions, and complex JSON operations. It provides specialized methods for array containment, IP address ranges, and conditional joins, while ensuring compatibility with modern Rails versions through a modular, autoloaded architecture.

Features

Extended Arel visitor support for PostgreSQL-specific operators and functions

The library now includes a dedicated Arel visitor decorator for PostgreSQL that enables correct SQL generation for a wider range of database-specific features. This change adds support for array containment operators (@\>, \<@), HStore containment, and various inet network operators (\>\>, \<\<, \<\<=, \>\>=, &&). It also introduces visitors for JSON and array aggregation functions, including ROW\_TO\_JSON, JSON\_BUILD\_OBJECT, JSONB\_BUILD\_OBJECT, TO\_JSON, TO\_JSONB, ARRAY, and ARRAY\_AGG, as well as a new AggregateFunctionName node that supports DISTINCT, custom ordering, and aliases.

_lib/active\_record\extended/arel/visitors · high confidence

New query methods for unions, CTEs, and conditional joins

This release introduces several new query capabilities to ActiveRecord. You can now chain unions using \.union\, \.union\_all\, \.union\_except\, and \.union\_intersect\, with support for ordering and aliasing the resulting union. Common Table Expressions (CTEs) are supported via \.with\, including recursive CTEs and materialization hints (\.materialized\, \.not\_materialized\). The library adds \.any\_of\ and \.none\_of\ for building OR/AND-NOT conditions, and \.either\_join\/\.either\_order\ for performing left outer joins with fallback associations. Additionally, JSON query methods like \.select\_row\_to\_json\, \.json\_build\_object\, and \.jsonb\_build\_object\ are available for constructing JSON responses directly in queries.

_lib/active\_record\_extended/query\methods · high confidence

New utilities for ORDER BY expressions and query support

This change introduces two new helper modules within the utilities directory to enhance query construction capabilities. The \OrderBy\ module provides logic to process and sanitize ORDER BY arguments, converting hash-based ordering specifications into Arel nodes and handling table path resolution for aggregate functions. The \Support\ module adds general-purpose query helpers, including methods to safely flatten values to SQL, wrap subqueries in aliased arrays or aggregated arrays (ARRAY\_AGG), construct FROM clauses with reference keys, and manage Common Table Expression (CTE) piping via \pipe\_cte\_with!\. These utilities also include helpers for double-quoting identifiers to avoid reserved keyword conflicts and converting ActiveRecord relations to Arel SQL nodes for broader compatibility.

_lib/active\_record\extended/utilities · high confidence

Removals

Removal of legacy PostgresExtended ActiveRecord integration files

The \lib/postgres\_extended\ directory has removed several core integration files, including \active\_record.rb\, \arel.rb\, and specific version decorators for Rails 5.0 and 5.2. This deletion eliminates the previous implementation of the \.overlap\ query method and its underlying Arel node visitor logic, effectively removing support for these specific ActiveRecord versions and the associated array overlap functionality from this library location.

_lib/postgres\extended · high confidence

Behavioural changes

Library renamed from PostgresExtended to ActiveRecordExtended with Rails 8.0 support

The library has been renamed from PostgresExtended to ActiveRecordExtended, reflecting a shift in scope and compatibility. The new entry point (lib/active\_record\_extended.rb) replaces the old one and explicitly checks for ActiveRecord version 8.0 or greater, indicating support for Rails 8. The module structure has been reorganized to use ActiveSupport's autoloader for better performance and modularity, separating utilities, patches, and query methods into distinct autoloaded namespaces. This change ensures the library is properly initialized and eager-loaded when Active Record is loaded.

lib · high confidence

Library renamed to ActiveRecordExtended and version bumped to 3.5.0

The library has been renamed from PostgresExtended to ActiveRecordExtended, with the main module and version file updated accordingly (version 3.5.0). The entry point lib/active\_record\_extended/arel.rb now explicitly requires the arel nodes, sql\_literal\_patch, aggregate\_function\_name, predications, and postgresql\_decorator components, establishing the new module structure.

_lib/active\_record\extended · high confidence

Project renamed to ActiveRecordExtended with updated test schema and CI configuration

The gem has been renamed from PostgresExtended to ActiveRecordExtended, requiring users to update their Gemfile and gemset names. The project has upgraded its minimum supported Ruby version to 3.1 and Rails version to 6.1, while dropping support for older versions. Travis CI has been removed in favor of GitHub Actions, and the test database schema has been redesigned to use a 'users' table with new associations (e.g., tags, profiles) and STI support to better reflect modern usage patterns.

(repo-wide) · high confidence

Refactor Arel node structure and introduce new query capabilities

The Arel layer has been restructured to support new PostgreSQL features and improve compatibility with Rails 6.1. A new \AggregateFunctionName\ node class has been added to handle aggregate functions with aliases and ordering, while \nodes.rb\ now dynamically defines specific nodes for JSON operations (\JsonBuildObject\, \ToJson\, etc.) and array containment. The \predications.rb\ file exposes new methods for IP address containment (\inet\_contains\, \inet\_contained\_within\) and array operations (\any\, \all\, \contains\). Additionally, a patch to \Arel::Nodes::SqlLiteral\ addresses a CTE alias warning in Rails 6.1, and the project has been renamed from PostgresExtended to ActiveRecordExtended.

_lib/active\_record\extended/arel · high confidence

Updated binstubs and renamed project to ActiveRecordExtended

The project has been renamed from PostgresExtended to ActiveRecordExtended, reflected in the bin/console script which now requires active\_record\_extended. Additionally, the bin directory now includes a comprehensive set of Bundler-generated binstubs for development tools (such as byebug, coderay, dotenv, pry, rspec, and rubocop) to ensure consistent execution environments, and the bin/bundle script has been updated to correctly broker Bundler version updates.

bin · high confidence

Test coverage

Added spec support files for database cleaning and test models; Added test coverage for Arel aggregate functions and updated spec infrastructure; Added test coverage for SQL inspection features; Added test coverage for new query methods; Added tests for Arel array and inet column predicates.

Dependencies

Added CI gemfiles for ActiveRecord 7.0 through 8.1 and head

New gemfiles have been added to the gemfiles directory to support testing against ActiveRecord versions 7.0, 7.1, 7.2, 8.0, 8.1, and the current head (development version) of Rails. Each gemfile pins the specific ActiveRecord version (e.g., \~\> 7.0.0, \~\> 8.1.0) and restricts the pg gem to versions less than 2.0, enabling continuous integration to validate compatibility across these supported and upcoming ActiveRecord releases.

gemfiles · high confidence

Gem renamed to active\_record\_extended with major dependency and Ruby version updates

The gem has been renamed from postgres\_extended to active\_record\_extended, requiring users to update their Gemfile references. The minimum supported Ruby version has been raised to 3.2, and the dependency on activerecord has been loosened to allow versions 5.2 and above (previously restricted to \< 6), while the pg gem requirement is now \< 3.0. Development dependencies have been significantly updated, including bundler (\>= 2.2), database\_cleaner (\~\> 2.0), and rubocop (now including rubocop-performance, rubocop-rake, and rubocop-rspec), alongside the addition of simplecov for test coverage reporting.

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

Lenses

  • Code Health 100
  • Architecture 100
  • Maturity 55
  • Readiness 61
  • Security 95

Changes since last survey

  • 300 commits — 269 feature/other, 31 fixes

By area

  • (root) — 161 commits
  • lib/active_record_extended — 82 commits
  • (repo) — 39 commits
  • spec/query_methods — 11 commits
  • spec/sql_inspections — 3 commits
  • .github/workflows — 1 commit
  • gemfiles/activerecord-50.gemfile — 1 commit
  • gemfiles/activerecord-60.gemfile — 1 commit
  • spec/support — 1 commit

Notable commits

  • fix: Apply Rails 5.0.x order by validation fix
  • fix: Apply regex fix .match? fix for ActiveSupport 5.0
  • fix: Bug fix: Duplicateded where constraints when using any_of/none_of
  • fix: Bug fx utilities and add a more module safe-flattening routine
  • fix: Bugfix Rails 6.1 Double init warning for Contains and Overlaps
  • fix: Bugfix window function where no partition by argument is provided
  • fix: Bugfix: Only append union values during a merge and do not override union name
  • fix: Bugfix: Prevent union from executing queries (#94)
  • fix: Bugfix: Union and Window Query Merging
  • fix: Fix "expect" -> "except" in Readme
  • fix: Fix Rails 7.1 install restriction
  • fix: Fix Ruby 2.7 warnings
  • fix: Fix UnionChain class to include the Utilities module
  • fix: Fix binstubs that broker during bundler version update (#121)
  • fix: Fixes Issue #91: SystemStackError when using .with (#105)
  • fix: Merge pull request #31 from GeorgeKaraszi/bugfix/unscoping-scope-instance
  • fix: Merge pull request #75 from GeorgeKaraszi/bugfix/window-and-union-merging
  • fix: Merge pull request #76 from GeorgeKaraszi/bugfix/ar-61-contains-overlap-fix
  • fix: Merge pull request #77 from GeorgeKaraszi/bugfix/bugfix-union-merge
  • fix: Rubocop fixes
  • …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

GeorgeKaraszi/ActiveRecordExtended 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 61984c277e0f5402362ad7271f415042fc537b0e — 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.