# Boolean trouble

**URL:** <https://www.ruby-forum.com/t/boolean-trouble/117398>\
**Category:** Rails\
**Created:** [October 16, 2007, 4:48pm UTC](https://www.ruby-forum.com/t/boolean-trouble/117398 "2007-10-16T16:48:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 16, 2007, 4:48pm UTC](https://www.ruby-forum.com/t/boolean-trouble/117398/1 "2007-10-16T16:48:08Z")

</div>

rails recognized a tinyint(1) in mysql as a boolean value, so a  
model.boolean = true writes a one, however a model.boolean = false  
writes nothing, how can I write a zero? if I do model.boolean = 0 it  
does not write anything in the database

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 16, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/boolean-trouble/117398/2 "2007-10-16T18:15:29Z")

</div>

I got it, the problem was that the validates presence of filter treats 0  
as  
nil.
