Sometimes you want your validation rules to be just a little bit more than the standard options available to you like ‘numeric’, ‘length’ or ‘safe’.
Occasionally you might need a value to be unique within it’s database column:
array('username', 'unique', 'className' => 'User');
But sometimes you want unique to be more intelligent with it’s unique validation…
The test above will only match when username is not unique AND active = 1. In the case of unique, criteria you define is appended to the existing check which would always take place.