Database default value problem

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs