rsvp.theoandpat.com had boolean flag to marked whether or not a visitor was going to be able to make it to our wedding. Unfortunately, if you selected you were not able to make it and submit the form, the application would return saying it could not process your submission because you have to say that you are going to make it. I argued, this is an RSVP form so you have to accept if you are RSVPing. That's the point of the RSVP! Only people RSVP would bother submitting the form! Pat wasn't too happy about that and ask/told me to fix it.Â
Digging into it, it turns out the way for
Reading up on the documentation, it is suggested to use
validates_presence_of
relies on Object#blank
which of course when sent
false.blank? # returns true
validates_inclusion_of
when dealing with booleans.
The one line change solved the problem:
validates_inclusion_of :accepted, :in => [true, false]