开发者

rails ajax currency

开发者 https://www.devze.com 2023-04-11 13:42 出处:网络
How to create the following: I want make ajax currency switcher with rails [usd|rub|eur] In db I have only usd value

How to create the following:

I want make ajax currency switcher with rails

[usd|rub|eur]

In db I have only usd value

What 开发者_如何学Pythongem suitable for this purpose? Or maybe browser-side solution is better?

Who has experience please give me advise


we use the Money Gem you can specify a Money column in your model to make the handling easier.

# Get exchange rates
Money.default_bank = ExchangeBankWhichScrapesXeDotCom.new
# new money object in USD
usd = Money.new(1000, "USD")
# exchange to rubel
rub = usd.exchange_to("RUB")
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号