jew*_*eer 5 ruby-on-rails spree
我正在将spree从spree 1.0升级到1.3并且遇到新的货币选项.
我想将价格换算为:'€100',而是获得'€100'.如何在单位和值之间获得空格?
注意:更改语言环境文件不起作用,因为它使用money gem.
There are a bunch of ways to do this. The easiest would probably be to re-register the Euro currency with a different symbol.
Put the following in an initializer:
# encoding: utf-8
Money::Currency.register({
:priority => 1,
:iso_code => "EUR",
:iso_numeric => "978",
:name => "Euro",
:symbol => "€ ",
:subunit => "Cent",
:subunit_to_unit => 100,
:separator => ".",
:delimiter => ","
})
Run Code Online (Sandbox Code Playgroud)
A rails console now reports:
> Spree::Money.new(100, currency: 'EUR')
=> € 100.00
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1686 次 |
| 最近记录: |