# magnusvk/counter_culture

Turbo-charged counter caches for your Rails app.

Repository: https://github.com/magnusvk/counter_culture
Canonical: https://ross.abutalabs.com/products/counter_culture
Language: Ruby
License: MIT
License Family: permissive
Topics: counter-cache, rails, ruby, gem, utility-library, activerecord, database
Last push: 2026-07-08T20:25:19+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 35, longevity 100
- inputs: {"age_days": 5214, "days_push": 56, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2118, forks 224 (observed 2026-08-28T04:06:16.411313+00:00)

## What it is
counter_culture is a Ruby gem that provides enhanced counter caches for Rails ActiveRecord applications. It keeps denormalized count and sum columns up to date on value changes, across multi-level relations, with dynamic column names.

## Use cases
- keep a count of associated records up to date in a parent table
- maintain running totals of child record values in Rails
- avoid expensive COUNT queries on large Rails associations
- track counts through multi-level ActiveRecord relations
- split counters by record type with dynamic column names

## When to choose
- you use Rails/ActiveRecord and need accurate, automatically maintained counter caches
- you need counters or sums that update when attribute values change, not just on create/destroy
- you need counters across has_many :through or nested relations

## When to avoid
- you are not using Ruby on Rails or ActiveRecord
- you expect .size on associations to use the cache - this gem does not change .size behavior
- you only need simple create/destroy counters and Rails' built-in counter_cache suffices

## Facets
- artifact type: library
- maturity: active
- function: database, caching, orm
- domain: databases, web-development, developer-tools
- platform: ruby
- tags: counter-cache, activerecord, rails-gem, denormalization, rails

## Member repositories
- magnusvk/counter_culture (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:16.411313+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:53:03.266308+00:00, confidence not recorded.
  - readme: https://github.com/magnusvk/counter_culture (fetched 2026-08-28T04:06:16.411313+00:00, sha 94caae76266d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
