Skip to content

Model Class

validationTypeForProperty()

validationTypeForProperty() — returns any

Available in: model Category: Miscellaneous Functions

Returns the type of validation that Wheels would apply for a given property. This is useful if you want to dynamically inspect a model’s property type or apply logic based on the property’s expected format.

NameTypeRequiredDefaultDescription
propertystringyesName of column to retrieve data for.
// Create a new employee object
employee = model("employee").new();

1. Assume 'firstName' is a varchar(50) column
employee.validationTypeForProperty("firstName") (This will output: "string")

2. Assume 'hireDate' is a datetime column
employee.validationTypeForProperty("hireDate") (This will output: "date")

3. Assume 'salary' is a numeric column
employee.validationTypeForProperty("salary") (This will output: "numeric")