Closed Neilos closed 6 months ago
Suppose we have a model
class Investment < ActiveRecord::Base monetize :value monetize :discounted_value end
and a subclass
class BadInvestment < Investment end
When we check the monetized_attributes of both the Product and SpecialProduct we get seemingly the same result:
Product
SpecialProduct
Investment.monetized_attributes # => { 'value' => 'value_cents', 'discounted_value' => 'discounted_value_cents', } BadInvestment.monetized_attributes # => { 'value' => 'value_cents', 'discounted_value' => 'discounted_value_cents', }
...but when we check the class of the monetized_attributes we can see that one is a ActiveSupport::HashWithIndifferentAccess while the other is a Hash.
monetized_attributes
ActiveSupport::HashWithIndifferentAccess
Hash
Investment.monetized_attributes.class # => ActiveSupport::HashWithIndifferentAccess BadInvestment.monetized_attributes # => Hash
This pull request fixes the discrepancy, ensuring both are a ActiveSupport::HashWithIndifferentAccess.
ty
Suppose we have a model
and a subclass
When we check the monetized_attributes of both the
Product
andSpecialProduct
we get seemingly the same result:...but when we check the class of the
monetized_attributes
we can see that one is aActiveSupport::HashWithIndifferentAccess
while the other is aHash
.This pull request fixes the discrepancy, ensuring both are a
ActiveSupport::HashWithIndifferentAccess
.