Skip to content
CAI
Software that uses CAICheck a score

jhawthorn/discard

68.0

Adequate · 19 September 2026

198

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 soft-delete functionality for ActiveRecord models, allowing records to be discarded and restored without permanent deletion. It supports both instance and bulk operations, custom discard columns, and transactional integrity to ensure data consistency during state changes. The library exposes scopes and query methods for filtering records based on their discard status and includes comprehensive test coverage using RSpec.

Behavioural changes

Discard gem v2.0.0: ActiveRecord 7.0+ requirement and transactional discard operations

The Discard gem has been updated to version 2.0.0, which raises the minimum supported version of ActiveRecord to 7.0, dropping support for Rails 6.x and earlier. Additionally, the \discard\ and \undiscard\ methods are now wrapped in a database transaction, ensuring that if a callback raises an exception, the database write is rolled back to maintain data consistency. The project has also migrated its test suite from Minitest to RSpec and updated its CI configuration to use GitHub Actions instead of Travis CI.

(repo-wide) · high confidence

Soft-delete functionality with undiscard support and custom columns

The library now provides a complete soft-delete implementation for ActiveRecord models. Users can discard and undiscard records using instance methods (discard, discard!, undiscard, undiscard!) as well as bulk class methods (discard\_all, discard\_all!, undiscard\_all, undiscard\_all!). The system supports custom discard columns via the :discard\_column option, includes callbacks for both discard and undiscard events, and introduces specific error classes (RecordNotDiscarded, RecordNotUndiscarded) for bang-method failures. Additionally, boolean query methods (discarded?, undiscarded?, kept?) and scopes (kept, undiscarded, discarded, with\_discarded) are available for filtering records.

lib/discard · high confidence

Test coverage

Added RSpec test configuration; Added test coverage for soft-delete model behavior; Removal of Minitest-based test suite.

Dependencies

Updated ActiveRecord support and development dependencies

The gem now requires ActiveRecord versions 7.0 through 8.x (specifically \>= 7.0, \< 9.0), dropping support for older Rails versions. Development dependencies have been updated to include RSpec (\~\> 3.13), database\_cleaner (\~\> 1.5), with\_model (\~\> 2.0), and sqlite3, while bundler and rake constraints have been loosened to support newer Ruby versions.

(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 69
  • Maturity 57
  • Readiness 79
  • Security 94

Changes since last survey

  • 158 commits — 150 feature/other, 8 fixes

By area

  • (root) — 72 commits
  • (repo) — 45 commits
  • .github/workflows — 20 commits
  • lib/discard — 14 commits
  • spec/discard — 5 commits
  • .github/ISSUE_TEMPLATE — 1 commit
  • .github/dependabot.yml — 1 commit

Notable commits

  • fix: Fix CI (#109)
  • fix: Fix association in README
  • fix: Fix tests
  • fix: Merge pull request #116 from okuramasafumi/fix-ci
  • fix: Merge pull request #118 from SuperGoodSoft/fix-tests
  • fix: Merge pull request #92 from joeljuca/fix-bad-ci-badge
  • fix: Pin concurrent-ruby to 1.3.4 to fix an error
  • fix: issue 95 fix undiscard returns false unless discarded?
  • change: Add .discard_all
  • change: Add Dependabot for GitHub Actions
  • change: Add Rails 5.2 and ruby 2.5 to travis
  • change: Add Rails 8.1 on Ruby 4.0 to test matrix
  • change: Add Ruby 3.2 to CI matrix. Use ruby/setup-ruby to avoid issues with bundler.
  • change: Add Ruby 3.3 to CI matrix
  • change: Add undiscarded? and kept? both as !discarded?
  • change: Add a CHANGELOG
  • change: Add a few docs
  • change: Add an informative gif
  • change: Add bang(!) methods
  • change: Add basic functionality
  • …and 138 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

jhawthorn/discard 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 f1abbd251eaa2ab656ad626b60a4a26e67ef678f — 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.