Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

%{value} in format message #32

@nyrsimon

Description

@nyrsimon

Firstly - awesome stuff you are building here, it's a big help!!

Am I doing something wrong - I'm trying to include the value of the field being tested in the custom error message. This works fine on inclusion but not on the 'format' check.

For example, this works great

currency: {
    presence: true,
    length: {is: 3},
    inclusion: {
        within: ccys,
        message: '%{value} is not a valid currency'
    },
    format: {
        pattern: /^[A-Z]{3}$/,
        message: 'is in an invalid format'
    }
}

But if I go with this

transaction_time: {
    presence: true,
    length: {is: 8},
    format: {
        pattern: /^[0-2][0-3]:[0-5][0-9]:[0-5][0-9]$/,
        message: '%{value} is in an invalid format '
    }
}

I get 'Transaction time %{value} is in an invalid format'

Am I doing something wrong or is it just not a feature at this point??

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions