Ruby on Rails -- Is a counter-cache transaction safe?

Viewed 1484

Will it handle the two people updating problem ok?

I googled and looked in the api but found nothing

Rails 3+, ruby 1.9.3

3 Answers

Given answers don't seem correct at least for Rails 5.x because it will execute SQL UPDATE that is atomic.

UPDATE .... SET counter = counter + 1
Related