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
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