Skip to content
CAI
Software that uses CAICheck a score

amatsuda/active_decorator

65.4

Adequate · 6 November 2026

448

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Rails generator for creating decorator classes

Users can now generate decorator classes using the \rails g decorator\ command. This new generator creates a decorator module in the \app/decorators\ directory, supports namespacing via class paths, ensures class name uniqueness to prevent collisions, and automatically hooks into the configured test framework to generate corresponding test files.

lib/generators/rails · high confidence

Add test\_unit generator for decorators

A new generator has been added for the test\_unit testing framework to create decorator tests. When invoked, it generates a test file (e.g., \decorator\_test.rb\) in the \test/decorators\ directory, respecting the class path and checking for class collisions to prevent overwriting existing tests.

_lib/generators/test\unit · high confidence

Added decorator generator template with frozen string literal

A new template file for the Rails decorator generator has been added, providing a basic module structure for decorators. The generated code includes the \frozen\_string\_literal: true\ magic comment to enforce immutable strings, aligning with modern Ruby best practices.

lib/generators/rails/templates · high confidence

Behavioural changes

ActiveDecorator 1.5.1 release with warning fixes and thread-safety improvements

This release updates the CHANGELOG to document version 1.5.1, which removes an unnecessary \ruby2\_keywords\ call to eliminate a specific warning and fixes an 'assigned but unused variable' warning for \view\_context\_stack\. It also records the changes from version 1.5.0, where the library switched from using \Thread.current\ to \ActiveSupport::CurrentAttributes\ for storing the ViewContext to improve thread safety, and stopped dropping keyword arguments when delegating helper methods via \method\_missing\.

(repo-wide) · high confidence

ActiveDecorator version bump to 1.5.1

The library version has been updated from 0.0.1 to 1.5.1. This release includes support for Rails 6.1, improved handling of ActionView::CollectionRenderer and ObjectRenderer, and fixes for Ruby 2.7 keyword arguments and Jbuilder partial rendering.

_lib/active\decorator · high confidence

Auto-decorating Action View render locals and objects

ActiveDecorator now automatically applies decorators to values passed as locals, the object, and collections when rendering partials via Action View. This behavior is implemented by monkey-patching the PartialRenderer, ObjectRenderer, and CollectionRenderer modules, with version-specific logic to handle Rails 6.1+ (decorating in \initialize\) versus earlier versions (decorating in \setup\).

_lib/active\_decorator/monkey/action\view · high confidence

Auto-decorating instance variables in controller views

The library now automatically decorates instance variables passed to views by patching the AbstractController::Rendering module. When a controller renders a view, any instance variables (ivars) included in the view context are now passed through the decorator instance, ensuring that decorated objects are available in the view without manual intervention.

_lib/active\_decorator/monkey/abstract\controller · high confidence

Auto-decoration of Active Record associations and collection methods

The library now automatically decorates associated records when accessed via Active Record associations. This is achieved by monkey-patching \Association\#target\, \CollectionProxy\#take\, and, for Rails 5.1+, \CollectionProxy\#last\, \find\_nth\_with\_limit\, and \find\_nth\_from\_last\. Additionally, \CollectionAssociation\#build\_record\ and \AssociationRelation\#spawn\ are patched to ensure the decoration marker is preserved when building new records or spawning relations.

_lib/active\_decorator/monkey/active\record · high confidence

Decoupling from Rails and adding configuration support

The library now supports usage outside of a Rails environment by making the Rails-specific railtie optional; if the 'rails' gem is not available, the library loads without error. Additionally, a new configuration module is introduced to allow customization of the decorator name suffix, and the core decorator logic is explicitly required.

lib · high confidence

Preserve view context during rescue\_from handling

ActiveDecorator now correctly maintains the view context when exceptions are handled via \rescue\_from\ in Action Controllers. By wrapping the \rescue\_with\_handler\ method, the library ensures that the current view context is pushed onto the stack before the rescue block executes and popped afterwards, allowing decorators to function correctly within error handling paths.

_lib/active\_decorator/monkey/action\controller · high confidence

Test coverage

2 commits adding/updating tests in test; Added RSpec template for decorator specs; Added controller test for fake detection; Added integration tests for decorator features; Added test template for decorators; Added tests for ActiveDecorator association decoration; Added tests for the RSpec Decorator Generator; Migrate test suite from RSpec to Test::Unit.

Dependencies

Updated dependency constraints and gem metadata for modern Ruby/Rails compatibility

The gemspec now declares an explicit runtime dependency on activesupport and populates development dependencies (test-unit-rails, selenium-webdriver, puma, capybara, sqlite3, rake, byebug), while the Gemfile replaces the insecure HTTP source with HTTPS and introduces conditional logic to pin specific versions of sqlite3, json, puma, nokogiri, loofah, concurrent-ruby, and power\_assert based on the running Ruby version or the RAILS\_VERSION environment variable. This ensures the gem works across a wider range of Ruby and Rails versions, including Ruby 3.4+ and Rails 7.1+, by bundling extracted standard library gems (mutex\_m, base64, bigdecimal, logger, benchmark, tsort) and handling version-specific constraints for dependencies like rackup and webdrivers.

(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 65 → 65 (-0.0)
  • 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 56 → 56 (+0.0)
  • Readiness 77 → 77 (+0.0)
  • Security 95 → 95 (-0.8)

Resolved (1)

  • Redundant configuration methods. Both methods appear to serve the same purpose of accessing or setting the library's configuration, violating the principle of least surprise and creating unnecessary API surface.

Changes since last survey

  • 10 commits — 10 feature/other, 0 fixes

By area

  • (root) — 3 commits
  • lib/active_decorator — 3 commits
  • (repo) — 1 commit
  • .github/workflows — 1 commit
  • test/decorator_test.rb — 1 commit
  • test/rails_app — 1 commit

Notable commits

  • change: 404
  • change: Add respond_to_missing? to ActiveDecorator::Helpers
  • change: Bump actions/checkout from 6 to 7
  • change: Changelog for 1.6.1
  • change: Don't swallow NameError raised from inside a decorator module
  • change: Merge pull request #129 from amatsuda/dependabot/github_actions/actions/checkout-7
  • change: Omit the URI decoration test under Rails' classic autoloader
  • change: Use safe_constantize to detect missing decorator modules
  • change: Version 1.6.0
  • change: Version 1.6.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

amatsuda/active_decorator 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 ea27ca2a8bd8e1911758d2482d9437598825cee2 — 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.