I am currently trying to insert some simple true/false radio buttons in Rails 3, but I can't find a way to make a radio button insert "false".
My code is the following:
<%= f.radio_button :accident_free, true %><label for="auction_accident_free_true">ja</label>
<%= f.radio_button :accident_free, false %><label for="auction_accident_free_false">nein</label>
I already tried:
- 1 / 0
- "1" / "0"
- true / false
- "true" / "false"
- "yes" / "no"
but nothing seems to work right for the value false. My field is set with
validates_presence_of :accident_free
and I always get the message that it has to be filled to continue, when clicking the false button. When clicking the true button, it works fine, but false doesn't get recognized.
Does anyone know how to do it correctly?
Thanks in advance
Arne
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…