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:
parent
aafcf11bdd
commit
1968fb0145
4 changed files with 24 additions and 28 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue