Return to v1.4.5 docs

validatesExclusionOf()



Validates that the value of the specified property does not exist in the supplied list.

Name Type Required Default Description
properties string Yes See documentation for validatesConfirmationOf.
list string Yes Single value or list of values that should not be allowed.
message string No [property] is reserved See documentation for validatesConfirmationOf.
when string No onSave See documentation for validatesConfirmationOf.
allowBlank boolean No false If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
condition string No See documentation for validatesConfirmationOf.
unless string No See documentation for validatesConfirmationOf.
// Do not allow "PHP" or "Fortran" to be saved to the database as a cool language
validatesExclusionOf(property="coolLanguage", list="php,fortran", message="Haha, you can not be serious. Try again, please.");