counter_cache to calculate child entries

Roger wrote:

The counter cache method can be used to store the number of child items with ease.
My scheme of things has multiple users adding entries into the child table. Will the active record handle this? Will the number be updated accordingly if more than one user simultaneously add child entries?

On third thoughts:

Yes, the counter cache will correctly handle concurrent child insertions
and removals, but any updates you do to parent objects should be done
in a "select...for update" transaction because the counter cache may be
updated by another request while the object is being found, updated, and
saved.

Really Active Record should be changed so it leaves out counter
cache attributes when doing update saves.