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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top