mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
7 lines
186 B
Ruby
7 lines
186 B
Ruby
|
class ExchangeRate < ApplicationRecord
|
||
|
def self.convert(from, to, amount)
|
||
|
rate = ExchangeRate.find_by(base_currency: from, converted_currency: to)
|
||
|
amount * rate.rate
|
||
|
end
|
||
|
end
|