나는 놀고있는 새로운 보석을 가지고있다. 그러나 그것을 초기화 할 수 있도록 어디에 두어야할지 모르겠다. 그러나 그것을 사용할 때마다 매번 그것을 할 필요가 없다. .어떻게 돈을 보석을 초기화합니까?
def self.get_rate(from, to, amount)
Money.default_bank.fetch_rates #<---------------- Here it is...
if to == "USD" or from == "USD"
rate = Money.default_bank.get_rate(from, to) * amount
else
rate_to_us = Money.default_bank.get_rate(from, "USD") * amount
rate = Money.default_bank.get_rate("USD", to) * rate_to_us
#rate = Money.default_bank.get_rate(params[:currency][:from], "USD")
end
rate = Money.new(rate.to_money,to).format(:with_currency)
end
내가 한 번, 그렇지 않으면 작동하지 않습니다 초기화해야하지만, 지금처럼 내가 할 경우, xml 파일과 다른 무엇을로드합니다. 하루에 한 번만로드되도록하려면 어떻게해야합니까?