Automatic Validations in CFWheels 1.1

July 21, 2010 · Chris Peters

A cool new feature coming up in CFWheels 1.1 is automatic validations.

A cool new feature coming up in CFWheels 1.1 is automatic validations.

In a nutshell, automatic validations remove the need for you to call simple validation functions like validatesPresenceOf(), validatesLengthOf(), and validatesNumericalityOf() in your models. CFWheels will introspect your database fields for signals like NOT NULL, data types, and maximum lengths. When you call save(), create(), or update(), CFWheels will run the validations for you based on this information (unless you specify otherwise).

If the database is already storing this information about your data, why not leverage it without writing any more code? Very clever stuff.

Feel free to follow along and see what’s coming up in the next version. There will be more.

About Chris Peters

With over 20 years of experience, I help plan, execute, and optimize digital experiences.

Leave a comment