It really depends on definition of Currency
. Below code shows that 10 USD is indeed equal to 1230 yen.
require "rails"
require "money-rails"
Money.add_rate('USD', 'EUR', 0.92)
Money.add_rate('USD', 'JPY', 123.0)
p 10.to_money.exchange_to('JPY') == Money.new(1230,"JPY")
#=> true
Your expectation that you should see 123000
may not be correct if you inspect the JPY
currency
p Money.new(1230,"JPY").currency
#<Money::Currency id: jpy, priority: 6, symbol_first: true, thousands_separator: ,, html_entity: ¥, decimal_mark: ., name: Japanese Yen, symbol: ¥, subunit_to_unit: 1, exponent: 0.0, iso_code: JPY, iso_numeric: 392, subunit: , smallest_denomination: 1>
Important field to note in Currency
definition is the value of subunit_to_unit: 1
. As per documentation:
:subunit_to_unit the proportion between the unit and the subunit
This means that in case of Yen, the value displayed is in Yen, and it need not be multiplied by 100 as is the case with USD or EUR.
p 10.to_money.exchange_to('EUR')
#=> #<Money fractional:920 currency:EUR>
p 10.to_money.exchange_to('JPY')
#=> #<Money fractional:1230 currency:JPY>
Below is Currency definition for EUR
#<Money::Currency id: eur, priority: 2, symbol_first: true, thousands_separator: ., html_entity: €, decimal_mark: ,, name: Euro, symbol: €, subunit_to_unit: 100, exponent: 2.0, iso_code: EUR, iso_numeric: 978, subunit: Cent, smallest_denomination: 1>
In case of EUR, subunit_to_unit: 100
indicates that value is in cents (or equivalent)