You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless legacy_default_currency! is used, models can't be validated if currency is missing. Calling valid? on the method will read all attributes and so it will end up calling Helpers.value_to_currency(currency) with nil currency which will raise in absence of defaults.
Only if both value and currency are null (and coerce_null is false), the validation can be performed as read_money_attribute will return early if value is nil.
The text was updated successfully, but these errors were encountered:
Note, this means that, by default, an invalid record where currency is nil, calling record.validate will result in a Money::Currency::UnknownCurrency error instead of ActiveRecord::RecordInvalid error, which is a break in convention.
Unless
legacy_default_currency!
is used, models can't be validated if currency is missing. Callingvalid?
on the method will read all attributes and so it will end up callingHelpers.value_to_currency(currency)
withnil
currency which will raise in absence of defaults.Only if both value and currency are null (and coerce_null is false), the validation can be performed as
read_money_attribute
will return early if value is nil.The text was updated successfully, but these errors were encountered: