Frage

I'm using the geddy framework and following the validation examples.

In my User model I have the following custom validation rule:

this.validatesWithFunction('password', function(val) {
    var re = /^[a-z0-9]+$/i;
    return re.test(val)
}, {message: 'must be alphanumeric'})

In my view I do this:

<% if(params.err['password']) { %><%=params.err['password'];%><% } %>

The validation rule does work as expected. However, the message I get back appears to me a generic ("password" is invalid) message rather than the one I have specified in the options ("must be alphanumeric").

Any pointers as to where I am going wrong please?

War es hilfreich?

Lösung

This was a bug we just fixed a few days ago. I'm not sure if it's been pushed to npm yet, but try updating and see if that resolves your problem.

Update: This should be fixed in npm version 0.9.9

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top