Reload doesn't always work correctly with money_column
sunblaze opened this issue · 0 comments
sunblaze commented
Just noticed this while reviewing #90
We set an instance variable when the currency is fixed or is readonly, but we don't clear the instance variable on a reload
of the model.
Here's an example test of the issue:
original = MoneyRecord.create!(price_usd: Money.new(1, 'USD'))
copy = MoneyRecord.last
copy.update!(price_usd: Money.new(2, 'USD'))
original.reload
assert_equal Money.new(2, 'USD'), original.price_usd