1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Add currency to account form to support multiple currencies (#481)

Co-authored-by: Sriram Krishnan <sriram@seafoodsouq.com>
Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
Sriram 2024-02-26 20:20:38 +05:30 committed by GitHub
parent aafcf11bdd
commit 1968fb0145
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 28 deletions

View file

@ -1,5 +1,7 @@
class ExchangeRate < ApplicationRecord
def self.convert(from, to, amount)
return amount unless EXCHANGE_RATE_ENABLED
rate = ExchangeRate.find_by(base_currency: from, converted_currency: to)
amount * rate.rate
end