diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cdb538da..11e7c53052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Upcoming 7.0.0.alpha - **Potential breaking change**: Fix USDC decimals places from 2 to 6 +- Allow `nil` to be used as a default_currency ## 6.19.0 diff --git a/lib/money/money.rb b/lib/money/money.rb index 6bd2ad6e38..f0ec3552c5 100644 --- a/lib/money/money.rb +++ b/lib/money/money.rb @@ -310,7 +310,7 @@ def self.from_amount(amount, currency = default_currency, options = {}) raise ArgumentError, "'amount' must be numeric" unless Numeric === amount currency = Currency.wrap(currency) || Money.default_currency - raise Currency::NoCurrency, 'must be provide a currency' if currency.nil? + raise Currency::NoCurrency, 'must provide a currency' if currency.nil? value = amount.to_d * currency.subunit_to_unit new(value, currency, options) @@ -356,7 +356,7 @@ def initialize(obj, currency = Money.default_currency, options = {}) # BigDecimal can be Infinity and NaN, money of that amount does not make sense raise ArgumentError, 'must be initialized with a finite value' unless @fractional.finite? - raise Currency::NoCurrency, 'must be provide a currency' if @currency.nil? + raise Currency::NoCurrency, 'must provide a currency' if @currency.nil? end # Assuming using a currency using dollars: