Skip to content
CAI
Software that uses CAICheck a score

charlotte-ruby/impressionist

58.9

Adequate · 6 November 2026

2.1k

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 library designed to track and record user impressions (views) within web applications. It provides a flexible, ORM-agnostic framework that supports ActiveRecord, Mongoid, and MongoMapper, allowing developers to count and filter view data based on criteria such as session, IP address, or user identity. The library handles the storage of request metadata like referrers and parameters while offering built-in mechanisms to filter out bot traffic and ensure impression uniqueness.

How it got here

2011 — ORM abstraction and Rails 4 compatibility

17 changes.

This period focused on decoupling the Impression model from ActiveRecord to support multiple ORMs and upgrading the library for Rails 4 compatibility. The work involved refactoring the core architecture, modernizing the development tooling, and removing legacy test infrastructure and dependencies.

2012–2020 — Multi-ORM support and test suite

9 changes.

The project expanded its compatibility to support multiple Object-Relational Mappers, including ActiveRecord, Mongoid, and MongoMapper, by implementing ORM-specific models and controller modules. This period also focused on stabilizing the codebase through the addition of a comprehensive RSpec test suite and a dummy Rails application for isolated testing.

Features

ActiveRecord models now support impression tracking

ActiveRecord models can now include the Impressionist::Impressionable module to enable impression tracking functionality. This change introduces the core integration point for ActiveRecord, allowing models to utilize the library's features for counting and recording user impressions.

_lib/impressionist/models/active\record · high confidence

Add Mongoid model support for Impressionist

Introduces a new Mongoid document class for tracking impressions, enabling the library to function with MongoDB-backed applications. This model defines the necessary fields (such as impressionable\_id, user\_id, and controller\_name) and integrates with the existing counter-cache logic, allowing users to track view impressions when using Mongoid instead of ActiveRecord.

lib/impressionist/models/mongoid · high confidence

Add Mongoid-specific impressionist controller implementation

A new controller module for Mongoid support has been added, which handles the creation of impression statements by automatically converting the request ID into a valid MongoDB ObjectId when necessary, ensuring compatibility with Mongoid's data types.

lib/impressionist/controllers · high confidence

Added asset pipeline manifest configuration

A new manifest configuration file has been added to the assets directory to explicitly define how the asset pipeline should process static resources. This configuration instructs the system to include all images from the images directory, as well as all JavaScript and CSS files from their respective directories, ensuring these assets are correctly compiled and served.

app/assets · high confidence

Adds MongoMapper support for tracking impressions

Users can now use the Impressionist gem with applications built on MongoMapper. This change introduces the necessary model definitions for storing impression data (Impression) and the extension module (Impressionable) that allows MongoMapper documents to be tracked, including polymorphic associations and automatic deletion of related impressions.

_lib/impressionist/models/mongo\mapper · high confidence

Removals

Removal of legacy test infrastructure files

The test application no longer includes the base controller definition or the Cucumber rake task generator. Specifically, \test\_app/app/controllers/application\_controller.rb\ has been deleted, removing the base controller class and its associated before-filter logic. Additionally, \test\_app/lib/tasks/cucumber.rake\ has been removed, eliminating the automated Rake tasks for running Cucumber features (ok, wip, rerun, all) that previously relied on vendored or gem-based Cucumber binaries.

_test\_app/app, test\app/lib · high confidence

Removed legacy Cucumber test infrastructure

The test application's Cucumber integration has been removed, specifically deleting the auto-generated step definitions (\web\_steps.rb\), the support environment configuration (\env.rb\), and the navigation path helpers (\paths.rb\). This eliminates the legacy Capybara and Spork-based test setup from the test app.

_test\_app/features/step\_definitions, test\app/features/support · high confidence

Removed legacy Rails 3.2 test application configuration

The test application's configuration files in test\_app/config have been deleted. This removes the legacy Rails 3.2.2 setup, including the application boot process, environment-specific settings (development, test, production), database configuration (SQLite3), routing, and initializers for session and secret tokens.

_test\app/config · high confidence

Behavioural changes

Cleanup of legacy test\_app scaffolding and configuration files

The test\_app directory has been cleaned up by removing obsolete scaffolding and configuration files. Specifically, the .gitignore, .rspec, and README files have been deleted, along with legacy executable scripts (script/cucumber and script/rails) that are no longer part of the modern Rails 3.2.2 application structure. This change removes clutter and aligns the test application with current standards by eliminating deprecated entry points and documentation.

_test\app · high confidence

Configuration API and ORM initialization overhaul

The library now uses a dedicated setup block (Impressionist.setup) for configuration instead of relying on a global PATH constant, and explicitly initializes the default ORM to Active Record. This change introduces a mattr\_accessor for the ORM setting and loads the engine via a new load module, shifting how users define and initialize the library's core behavior.

lib · high confidence

Database schema updates for impressions table across versions 0.3.0, 0.4.0, and 1.5.2

Upgrade migrations have been added to modify the impressions table structure. Version 0.3.0 introduces a session\_hash column and restructures indexes to support separate tracking by request hash, IP address, and session hash for both impressionable entities and controller actions. Version 0.4.0 adds a referrer column to capture traffic source data. Version 1.5.2 adds a params column to store request parameters and creates a corresponding index for efficient querying by impressionable entity and parameters.

_upgrade\migrations · high confidence

Enhanced impression tracking with uniqueness, conditional logic, and filtered parameters

The controller now supports more granular control over impression recording. Users can define unique impression criteria (e.g., by session or specific parameters) to avoid counting duplicate views, and apply conditional logic using \:if\ and \:unless\ options to include or exclude impressions based on custom conditions. Additionally, request parameters stored in impressions are now filtered to exclude sensitive data (like passwords) using Rails' parameter filtering, and the system ensures compatibility with Rails 5+ by using \before\_action\ instead of the deprecated \before\_filter\.

app/controllers · high confidence

Generator now supports multiple ORMs and adds database indexes

The installation generator has been refactored to support multiple Object-Relational Mappers (ActiveRecord, Mongoid, and MongoMapper) via a unified entry point that delegates to ORM-specific generators. For ActiveRecord, the generated migration now dynamically inherits from the correct Rails version class and includes additional database indexes on columns such as session\_hash, referrer, params, and user\_id to improve query performance.

lib/generators · high confidence

Impressionist 2.0: ORM abstraction and Rails 4 compatibility

This release introduces a major architectural shift to support multiple Object-Relational Mappers (ORMs) and Rails 4. The engine now dynamically loads ORM-specific models (such as Mongoid) via a new \include\_orm\ mechanism, allowing users to choose their backend. Compatibility with Rails 4 is achieved by conditionally including \attr\_accessible\ only when Strong Parameters are not in use, and by switching the bot-list fetching logic from the deprecated \httpclient\ gem to Ruby's standard \Net::HTTP\ with a timeout. Additionally, the \is\_impressionable\ macro now uses \dependent: :delete\_all\ for associations, and the version is bumped to 2.0.0.

lib/impressionist · high confidence

Project maintenance and tooling overhaul

This update modernizes the project's development infrastructure and documentation. The Rakefile has been refactored to replace the deprecated Jeweler gem with Bundler and RSpec for task management and testing. New configuration files have been added to enforce code quality and consistency: a \.rubocop.yml\ file with specific style rules, a \.rspec\ file for test runner settings, and an updated \.gitignore\ to exclude generated artifacts and test app files. Documentation has been consolidated by replacing the legacy \README.rdoc\ with a comprehensive \README.md\ and introducing a new \UPGRADE\_GUIDE.md\ to assist with database schema migrations. Additionally, the copyright year in \LICENSE.txt\ has been updated to 2018.

(repo-wide) · high confidence

Refactored impressionable module and added bot filtering logic

The Impressionable module has been refactored to extend ActiveSupport::Concern, introducing a ClassMethods namespace for configuration (such as counter cache options) and instance methods for counting impressions. The counting logic now accepts an options hash, allowing users to filter by message and handle date ranges more flexibly, while also optimizing queries for Rails 4+. Additionally, a new bot detection method (bot?) has been added to the Bots module, enabling the system to identify and potentially bypass impressions from known web crawlers based on user-agent strings.

app/models/impressionist · high confidence

Removal of ActiveRecord dependency from Impression model

The Impression model no longer inherits from ActiveRecord::Base and has removed the polymorphic belongs\_to association. This change decouples the model from the ActiveRecord ORM, allowing it to function independently of specific database adapters or ORM implementations.

app/models · high confidence

Removed database schema and seed files from test\_app

The \schema.rb\ and \seeds.rb\ files in the \test\_app/db\ directory have been deleted. This change removes the auto-generated database schema definition and the default data seeding script from the test application, likely to rely on migrations or other setup mechanisms instead.

_test\app/db · high confidence

Removed default Rails public assets and error pages

The test application no longer serves default static files for HTTP errors (404, 422, 500) or the default welcome page. Additionally, legacy client-side libraries (Prototype.js, script.aculo.us) and the Rails UJS driver (rails.js) have been removed from the public directory, indicating a shift away from the default Rails asset pipeline or a move to a different frontend stack.

_test\app/public · high confidence

Support for non-restful controllers and Rails 5 compatibility

The library now correctly handles controllers without associated models (non-restful controllers) by making the polymorphic association optional, preventing errors when updating counter caches. It also adds compatibility with Rails 5 by conditionally setting the \belongs\_to\ association and includes a new \SetupAssociation\ class to manage version-specific model setup. Additionally, the counter cache logic has been refactored to support custom unique filters (e.g., by IP address or other criteria) and includes a migration to add a \params\ field for storing request data.

impressionist · high confidence

Fixes

Added Mongoid compatibility for impression counting

Added a new Mongoid-specific implementation of the \Impressionable\ module that overrides the \impressionist\_count\ method to work with Mongoid documents. This change enables users to filter impressions by date range and distinct fields when using Mongoid, resolving previous compatibility issues and startup crashes associated with the Mongoid wrapper.

lib/impressionist/models/mongoid/impressionist · high confidence

Test coverage

Added isolated RSpec test suite and dummy Rails application; Removal of legacy test infrastructure files; Removed legacy Impression model specs; Removed legacy controller specs for Articles, Posts, and Widgets.

Dependencies

Modernize gem dependencies and test infrastructure

The gem's dependency management has been significantly updated: the test application Gemfile was removed, the main Gemfile now uses HTTPS for the RubyGems source and relies on the gemspec for runtime dependencies, and the gemspec itself was rewritten to use \frozen\_string\_literal\, dynamic versioning, and explicit runtime dependencies for \friendly\_id\, \nokogiri\, and \rails\ (\>= 3.2.15). Development dependencies were cleaned up, removing legacy tools like \jeweler\, \rcov\, and \mongrel\, while adding modern testing and linting tools such as \minitest\, \pry\, \rubocop-rails\, \rubocop-rspec\, and \simplecov\. SQLite3 was updated to \~\> 2.0, and JRuby-specific adapters were added to the main Gemfile.

(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 59 → 59 (-0.2)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 59 → 59 (+0.0)
  • Architecture 97 → 97 (+0.0)
  • Maturity 41 → 41 (+0.0)
  • Readiness 80 → 80 (+0.0)
  • Security 95 → 92 (-3.2)
  • Domain Modelling 100 → 100 (+0.0)

Resolved (3)

  • Duplicate method definition across different modules. Both Impressionable and IsImpressionable expose a class method is_impressionable with identical signatures. This suggests redundant module inclusion or copy-paste errors in the API surface.
  • Naming collision and ambiguity. ImpressionistController has an instance method impressionist that takes arguments, while Impressionable (likely a model concern) has a class method impressionist that takes options. While the contexts differ (Controller vs Model), the shared name impressionist for both configuration (class method) and action (instance method) is confusing. Furthermore, ImpressionistController is a controller class, but the methods are defined in ClassMethods and InstanceMethods blocks, suggesting a mixin pattern, yet the naming implies a direct controller action.
  • Redundant method names with identical intent. impressionist_counter_caching? and counter_caching? appear to check the same state. The prefix impressionist_ is redundant given the context of the Impressionable module.

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

charlotte-ruby/impressionist 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 b13ac939863c2fcb46ee63a1362185b60fce7d33 — 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.