How our users exploited concurrency and how we fixed it - Evil Trout's BlogHow our users exploited concurrency and how we fixed it - Evil Trout's Blog: "# Keep everything in a database transaction
# Find the player's current goal
goal = player.goal
# Make sure we don't reward goals that have been already been completed
goal.update_column :completed, true
After much headdesking, I eventually discovered that the above code is not safe under concurrency."
'via Blog this'