Rails 3 2 counter cache not updating

Rated 4.53/5 based on 539 customer reviews

By default, counter_culture will run counter cache updates inside of the same Active Record transaction that triggered it.

(Note that this bevavior changed from version 0.2.3 to 1.0.0.) If you would like to run counter cache updates outside of that transaction, for example because you are experiencing deadlocks with older versions of Postgre SQL, you can enable that behavior: in conjunction with transactional fixtures will lead to your tests no longer seeing updated counter values.

This is required when adding counter-caches to existing data.This is because the counter caches are incremented or decremented when you create or delete an instance of the model.Counting associations represents a performance improvement by avoiding eager loading and N 1 queries for listings -- e.g.I love learning new technologies, programming, blogging and participating the forum discussions more...The world’s largest hotel is in Saudi Arabia, hosts 10,000 guests, and looks pretty much how you would expect the world’s largest hotel in Saudi Arabia to look.

Leave a Reply