# Database default value problem

**URL:** <https://discuss.rubyonrails.org/t/database-default-value-problem/33925>\
**Category:** rubyonrails-talk\
**Created:** [September 3, 2008, 1:16am UTC](https://discuss.rubyonrails.org/t/database-default-value-problem/33925 "2008-09-03T01:16:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepe1](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pepe1](https://discuss.rubyonrails.org/u/pepe1)\
**Post date:** [September 3, 2008, 1:16am UTC](https://discuss.rubyonrails.org/t/database-default-value-problem/33925/1 "2008-09-03T01:16:02Z")

</div>

Hello.

I am running into an issue I would like to know if there is a solution for. I am running Ruby version 1.8.6 and Rails 1.2.3. My database is Oracle (10g) and I have one field defined as:

MY\_FIELD NUMBER(1,0) DEFAULT '2'

When a record is created in the database the value that invariable gets posted to the table is 0 (zero) instead of 2. However, if I change the field to:

MY\_FIELD NUMBER(2,0) DEFAULT '2', the default value of 2 is correctly posted.

I have the feeling that Ruby and/or Rails are considering the NUMBER(1,0) field as a true/false container and anything that is not a 1 (true) will be converted to a 0 (false), including the default value.

Any ideas why this is happening and/or how to solve it short or modifying the column's length?

Thanks in advance.

Pepe
