Putting Rails in a corner: Understanding database isolation
summary
Explains concrete fixes: Rails 4 lets transactions take an isolation param so databases trade read committed vs repeatable read vs serializable for performance; a race in a “Congrats!” app (Reese signs while Dana removes) shows ActiveJob reading outside a transaction, so pass the card I.D., reload inside the transaction, or add a committed_to_send flag to make sending idempotent. Serialization failures surface as ActiveRecord::StatementInvalid (DB-driver specific). Tests must avoid transactional fixtures to change isolation — use truncation and heavy load or randomized sleeps to reproduce issues.
AI-written summary · about
chapters (16)
- 0:00Intro
- 1:25Who is this talk for
- 3:14Context
- 6:53Simultaneous events
- 9:26Why are we in inconsistent states
- 10:20Isolation levels
- 11:52Read Committed
- 13:44Serializable
- 15:43Parameter changes
- 16:26Active record
- 17:31Active job
- 19:38Commit to send
- 21:00Loops
- 24:35Tests
- 26:33Review
- 27:10Conclusion








