Skip to content

Can't validate money/currency presence in model #260

Description

@rporrasluc

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions