Financial primitives
Turn complexity into clarity.
A Rails engine providing a single source of truth for currency values using a polymorphic Coin ledger.
4K
Downloads
1
GitHub star
v0.5.0
Latest release
7
Releases
Overview
Give every model that handles money a consistent interface, without adding another pair of amount and currency columns to its table. Midas stores values in a shared, polymorphic Coin ledger:
class Product < ApplicationRecord
include WhittakerTech::Midas::Bankable
has_coin :price
end
Use the same approach for prices, fees, balances, or several independent values on one record. Midas handles currency-aware amounts and conversion, so money behavior can stay consistent as your application grows.
From monetary values to auditable flows
For everyday model attributes, Coin and Bankable are the core. When billing or payments also need a clear, auditable explanation of how balances changed, Midas adds a double-entry Ledger with balanced, immutable postings. The Ledger complements the simpler value model; it does not replace it. See the documentation for the API and implementation details.
Key features
-
Polymorphic Coin ledger
One
Coinmodel stores every monetary value, for any model. -
Multi-currency support
Built on the
moneygem, with conversion between currencies. -
Declarative DSL
has_coinandhas_coinsattach money to a model in one line. -
Zero schema duplication
No more
price_centsand currency columns repeated across tables. -
Headless currency input
A Stimulus-powered input field that leaves the markup to you.
-
Tested and documented
90%+ test coverage, full API documentation and an architecture overview.
-
Additive double-entry ledger
Record balanced, immutable postings when a monetary workflow needs an auditable trail.
Installation
gem "whittaker_tech-midas"
bundle install
bin/rails generate whittaker_tech:midas:install
bin/rails db:migrate
Common use cases
- Product catalogs and configurable pricing
- Multi-currency applications
- Invoices, billing, fees and payments
- Models with multiple independent monetary values
Roadmap
- Exchange rate fetching
- Versioned coin histories
- ViewComponent integrations
- Billing integration examples (Stripe and LemonSqueezy)