mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 19:44:09 +00: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user