Categories
Programming

Proper Counter Cache Migrations in Rails

A lot of people are doing a lot of heavy lifting in their database migrations when deploying. That might work well for people when their data set is ~1 000 records, but when you are working with 500 000+ records, that’s just not feasible.

There’s a lot of bad advice in terms of counter_cache and Rails so I wanted to make sure this one got some extra visibility.

http://ryan.mcgeary.org/2016/02/05/proper-counter-cache-migrations-in-rails/