Skip to content
CAI
Software that uses CAICheck a score

collectiveidea/audited

61.0

Adequate · 28 September 2026

1.2k

lines of production code

Ruby

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the Audited gem, a Ruby library that provides versioning and audit trail capabilities for ActiveRecord models. It tracks create, update, and destroy actions, allowing users to undo changes and group related modifications by request UUID. The library supports a wide range of Rails versions and includes features for conditional auditing, field redaction, and configurable database schemas.

How it got here

2006 — Rails 8.0 support and API modernization

6 changes.

The project underwent significant modernization to support Rails 8.0, replacing legacy Rakefiles and plugin structures with Bundler and RSpec tasks. The core library was refactored to use the modern Audited API, removing obsolete code and documentation while introducing thread-safe auditing contexts. Comprehensive tests were added for migration generators to ensure compatibility with supported Rails versions.

2008–2010 — Testing infrastructure and gem consolidation

6 changes.

The project established a comprehensive RSpec-based test suite using a mock Rails application to ensure compatibility across multiple Rails versions. Concurrently, the gem was consolidated into a single distribution package, dropping support for older Ruby and Rails versions while updating development dependencies.

2012–2020 — Rails 6+ compatibility and audit enhancements

8 changes.

This period focused on modernizing the Audited gem to support Rails 6 through 8.0, introducing features like request UUID tracking, undo capabilities, and around\_audit callbacks. Extensive test coverage was added to ensure compatibility across diverse Rails versions and database configurations, including PostgreSQL JSON types and Sprockets requirements.

Features

Audit model now supports undoing changes and grouping by request UUID

The Audit model now includes an \undo\ method that allows users to reverse create, update, and destroy actions by restoring previous states or deleting records. Additionally, audits are now automatically assigned a \request\_uuid\ to facilitate grouping of changes originating from the same controller request, and the \revision\ method has been updated to use \audit\_version\ for accurate reconstruction of model states.

audited · high confidence

Audited gem v5.8.0 introduces around\_audit callbacks, Rails 6 touch auditing, and request UUIDs

The audited library (v5.8.0) adds support for \around\_audit\ and \after\_audit\ callbacks, allowing users to hook into the audit lifecycle for notifications or access to the newly created audit record. It now audits \touch\ events on Rails 6 and later, and automatically captures a \request\_uuid\ on all audits to facilitate grouping by request. The gem also introduces a \redacted\ option to log field changes without storing the actual values, and registers the \Audited::Sweeper\ via a Railtie to ensure thread-safe storage of current user, IP, and request UUID across controller actions.

lib/audited · high confidence

New install and upgrade generators for the Audited gem

The library now provides \InstallGenerator\ and \UpgradeGenerator\ to manage the \audits\ table schema. The install generator creates the initial table with configurable column types for \audited\_changes\ (defaulting to text) and \audited\_user\_id\ (defaulting to integer), including support for a \request\_uuid\ column to group audits by request. The upgrade generator automatically detects existing schema states and applies necessary migrations, such as renaming the \changes\ column to \audited\_changes\, adding \comment\ and \remote\_address\ columns, handling the \association\ to \associated\ rename, and adjusting polymorphic index orders to ensure compatibility with newer Rails versions.

lib/generators · high confidence

Removals

Removal of acts\_as\_audited Rake task stub

The placeholder Rake task file for the acts\_as\_audited plugin has been removed from the tasks directory. This cleanup eliminates an unused, commented-out task definition that previously existed in the project's build scripts.

tasks · high confidence

Removal of acts\_as\_audited plugin documentation

The generated RDoc documentation for the acts\_as\_audited plugin has been removed from the repository. This includes the class, file, and method index pages, as well as the detailed documentation for the CollectiveIdea::Acts::Audited module and its associated methods (such as acts\_as\_audited, audit\_condition\_met?, and without\_auditing).

rdoc, rdoc/files · high confidence

Behavioural changes

Migration to modern Audited API and removal of legacy code

The library has been refactored to replace the legacy \acts\_as\_audited\ module with the modern \Audited\ namespace. The old \lib/acts\_as\_audited.rb\ and \lib/audit.rb\ files have been removed, and the main entry point is now \lib/audited.rb\, which introduces a new \Audited::RequestStore\ class wrapping \ActiveSupport::CurrentAttributes\ for thread-safe auditing context. Configuration is now centralized via \Audited.config\, and the library now includes \lib/audited-rspec.rb\ to provide RSpec matchers for testing audit behavior. Users must update their code to use the new \Audited\ module methods and ensure they are on a supported Rails version.

lib · high confidence

Repository modernization and Rails 8.0 support

The project has been modernized by replacing the legacy Rakefile with Bundler and RSpec tasks, adding StandardRB for code style enforcement, and configuring Appraisals to test against Rails versions 5.2 through 8.0 (including the main branch). This update also drops support for older Rails versions (4.x and 5.0/5.1), removes legacy plugin files (init.rb, install.rb), and updates the README to reflect current compatibility with Rails 7.2, 7.1, 7.0, 6.1, 6.0, and 5.2.

(repo-wide) · high confidence

Test coverage

Added RSpec test suite and helpers for the Audited gem; Added Sprockets manifest for Rails 6 test compatibility; Added comprehensive test suite for auditing features; Added mock Rails app initializers for RSpec testing; Added mock Rails application configuration for testing; Added test environment configuration for the mock Rails application; Added test fixtures for auditing features and Rails version compatibility; Added test migrations for JSON and JSONB audited\_changes column types; Added tests for install and upgrade migration generators; Added tests for migration generators; Removed test fixture for User model.

Dependencies

Consolidate into single 'audited' gem with Rails 5.2–8.1 support

The project is now distributed as a single gem named 'audited', removing previous split packaging. The gem now requires Ruby 2.3.0 or higher and supports ActiveRecord and ActiveSupport versions ranging from 5.2 up to (but not including) 8.2, effectively dropping support for older Rails versions while adding compatibility with Rails 8.1. Development dependencies have been updated to include 'standard' for linting, 'single\_cov' for coverage, and specific database adapters for testing.

(dependencies) · high confidence

Expanded support for Rails 5.2 through 8.0 and main branch

The gemfile matrix has been updated to include dedicated test configurations for Rails versions 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, and 8.0, as well as the Rails main development branch. This change ensures the library is tested against a broader range of Rails releases, with specific dependency adjustments such as pinning \psych\ and \loofah\ for Rails 5.2 and updating \sqlite3\ and \pg\ gem constraints for newer versions to maintain compatibility.

gemfiles · 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

Score

  • CAI 61 → 61 (+0.5)
  • Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.

Lenses

  • Code Health 98 → 98 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 52 → 52 (+0.0)
  • Readiness 58 → 58 (+0.0)
  • Security 70 → 76 (+5.9)
  • Domain Modelling 100 → 100 (+0.0)

Resolved (1)

  • Documentation: no usage examples (README.md)

New (2)

  • Ambiguous signature difference. Both instance and class methods are named 'without_auditing', but the instance method takes a block (implying temporary suspension for a duration) while the class method signature provided does not show a block argument (implying a toggle or configuration change). This inconsistency in arity and behavior under the same name is confusing.
  • Inconsistent naming for retrieving audit history. Instance methods use 'revision' and 'revision_at' to fetch specific versions, while the Audit class has a method named 'revision()' which likely returns the revision number or ID of the audit record itself, not a lookup operation. This creates ambiguity between 'getting a revision' (lookup) and 'getting the revision attribute' (property access).

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

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/audited 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 28 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 dbf8432604ec97734bcfb3dc6df61f4faa0d1b84 — the exact code this score is about.
  • Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.