A double-entry accrual accounting system for your application.  Currency-agnostic but uses the Money gem.  Account holder support and contexts are built-in.