Question

I added a couple columns to a table in MySQL:

  • totalSavings DOUBLE NOT NULL DEFAULT 0
  • totalDebt DOUBLE NOT NULL DEFAULT 0

There are several other columns in the table configured in a similar manner, and CFWheels is appropriately adding a validatesPresenceOf validation to those properties.

But my new ones are not being picked up as required by CFWheels automatic validations. Why is that?

Was it helpful?

Solution

As it turns out, CFWheels will skip the validatesPresenceOf automatic validation if there is a DEFAULT value set on the column.

I needed to add the DEFAULT 0 to the column initially so records would be set with that default. But then removing the default fixed the issue with the validation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top