summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-04 11:43:51 -0600
committermo khan <mo.khan@gmail.com>2020-05-04 11:43:51 -0600
commit0a2a83ed17ceb910a29596a11d7c309c3c010e7a (patch)
tree67f174f0c392ca65c5f0854940ffb8f99a3d362a
parent01b1c72b8bd8cd7af1d43c935a40b098fc827f7b (diff)
Add note on transactions in partitioning in rails
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
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.