Class: UsageCredits::Allocation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- UsageCredits::Allocation
- Defined in:
- lib/usage_credits/models/allocation.rb
Overview
An Allocation links a negative (spend) transaction to a positive (credit) transaction, indicating how many credits were taken from that specific credit source.
Allocations are the basis for the bucket-based, FIFO-with-expiration inventory-like system This is critical for calculating balances when there are mixed expiring and non-expiring credits Otherwise, balance calculations will always be wrong because negative transactions get dragged forever More info: x.com/rameerez/status/1884246492837302759