validates_presence_of with a boolean set to false doesn't work...
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]Posted in Ruby on Rails | no comments |
Trackbacks<
Use the following link to trackback from your own site:
http://nopugs.com/trackbacks?article_id=34