mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
* Initial foundational pass at multi-currency * Default format currency * More work on currency and exchanging * Re-build currencies on change * Currency import/setup * Background job overhaul + cheaper OXR plan support * Lint fixes * Test fixes * Multi-currency setup instructions * Allow decimals in the balance field * Spacing fix for form --------- Signed-off-by: Josh Pigford <josh@joshpigford.com>
6 lines
186 B
Ruby
6 lines
186 B
Ruby
class ExchangeRate < ApplicationRecord
|
|
def self.convert(from, to, amount)
|
|
rate = ExchangeRate.find_by(base_currency: from, converted_currency: to)
|
|
amount * rate.rate
|
|
end
|
|
end
|