No Pugs

they're evil

It looks like if a boolean property is set to false and it has a validates_presence_of validation on it, that the validation will fail. At least in rails 2.3.8 and rails 2.3.5 and I’m assuming all older and possibly newer versions.

It probably has to do with this:

  false.blank?

evaluating as true.

What worked for me was to use validates_inclusion_of instead:

  validates_inclusion_of :is_present_in_sentence, :in => [true, false]

Published on 04/12/2011 at 09:32AM under .

0 comments

Powered by Typo – Thème Frédéric de Villamil | Photo Glenn