From 0a2a83ed17ceb910a29596a11d7c309c3c010e7a Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 4 May 2020 11:43:51 -0600 Subject: Add note on transactions in partitioning in rails --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 293e51c..7b12401 100644 --- a/README.md +++ b/README.md @@ -2953,3 +2953,22 @@ Rails.application.config.generators do |g| g.orm :active_record, primary_key_type: :uuid end ``` + +## rails transactions + +```ruby +t.decimal :amount, precision: 10, scale: 2 + +class Account + def withdraw(quantity) + self.amount -= quantity + save! + end + + def deposit(quantity) + self.amount += quantity + end +end +``` + +Partition data using [pg_party](https://github.com/rkrage/pg_party) gem. -- cgit v1.2.3