mirror of
https://github.com/we-promise/sure.git
synced 2026-04-24 22:44:14 +00:00
Add multi currency demo accounts (#530)
This commit is contained in:
@@ -3,6 +3,12 @@ class ExchangeRate < ApplicationRecord
|
||||
return amount unless EXCHANGE_RATE_ENABLED
|
||||
|
||||
rate = ExchangeRate.find_by(base_currency: from, converted_currency: to)
|
||||
amount * rate.rate
|
||||
|
||||
# TODO: Handle the case where the rate is not found
|
||||
if rate.nil?
|
||||
amount # Silently handle the error by returning the original amount
|
||||
else
|
||||
amount * rate.rate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user