Mo Money Mo Problems (with Ruby)
summary
Don't use floats for money; store amounts as integer cents or accept BigDecimal's memory cost. Use deterministic rounding like round half to even (banker's rounding). Run captures asynchronously with background jobs (ActiveJob or similar) and serialize related steps with transactions or Mutex locks so captures and payouts remain atomic. Keep per-transaction ledgers read-only, persist exchange rates for multi-currency work, and abstract gateway code (Stripe, PayPal, Braintree) behind a payment-source interface.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 2:12Handling money in databases
- 4:20Rounding and currency
- 10:48Using the Money gem
- 12:56Security and background jobs
- 15:41Concurrency and integrity
- 18:23Timing and logging
- 20:26System architecture
- 22:25Fraud detection and close
related talks
38mI see your 127.32+, a tale of rationals
47mWhat All Rubyists Should Know About Threads
30mBuilding Scalable & Resilient Background Jobs for FinTech
03mRuby Love – Sharon DeCaro
11mRunning Jobs at Scale
32mWhy We Can't Have Nice Things: FLoats, Dates, and Names
44mMo' Jobs Mo' Problems: Lessons Learned Scaling to Millions of Jobs an Hour
26mFrom OO Patterns to Functional Programming w/o Killing Yourself
