문제

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