diff --git a/CHANGELOG.md b/CHANGELOG.md index 277991a5b7..2c5f169898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Fix `Money::Currency.register` exception when table is not initialized. + ## 7.0.1 - Re-publishing gem to fix file permissions https://github.com/RubyMoney/money/issues/1170 diff --git a/lib/money/currency.rb b/lib/money/currency.rb index d2d2362741..99b50f57b9 100644 --- a/lib/money/currency.rb +++ b/lib/money/currency.rb @@ -173,7 +173,7 @@ def stringified_keys def register(curr) key = curr.fetch(:iso_code).downcase.to_sym @@mutex.synchronize { _instances.delete(key.to_s) } - @table[key] = curr + table[key] = curr @stringified_keys = nil clear_iso_numeric_cache end @@ -184,7 +184,7 @@ def register(curr) # @param curr [Hash] See {register} method for hash structure def inherit(parent_iso_code, curr) parent_iso_code = parent_iso_code.downcase.to_sym - curr = @table.fetch(parent_iso_code, {}).merge(curr) + curr = table.fetch(parent_iso_code, {}).merge(curr) register(curr) end