Skip to content

Skip { after: :other_attribute } validation if other_attribute is nil #87

@slucaskim

Description

@slucaskim

🦄 Feature Request

Is your feature request related to a problem?

When I'm using the after syntax using an attribute:

validates :expiration_date, date: { after: :packaging_date }

but then packaging_date is a nilable attribute, the validation fails when packaging_date is blank.

Describe the solution you'd like

The more sensible behaviour to me is if the after validation is only applied in case where packaging_date is present. If packaging_date is blank, the date validation should just check the date format of expiration_date.
If this makes sense with the authors and the users, I'm totally willing to put in a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions