How to use validation in Model

I was setting a custom validation for my User model:

public function validation()
{
    $this->validate(new \Phalcon\Mvc\Model\Validator\PresenceOf([
            'field' => 'nick',
            'message' => 'stupid validation'
    ]));

    return !$this->validationHasFailed();
}

It throws the same default message everytime (nick is required). Shouldn't be replaced with the new message? It worked the first time I did it (I thought).

edited Nov '14

Maybe you have same validator in your form, and the default message comes from there. :/



19.6k
edited Nov '14

Nope, I only have the model's validator as a validator in the whole app, nothing more.

EDIT: I've investigated more and did a manually $user->validation(). And guess what? Prints the personalized messages.

So, the problem is that $user->create/save/update() isn't calling the validation. Why?