This is a new post for a message I didn't get any answers to. I hope
this post catches somebody's eye and helps me with the issue. Sorry
for the duplication but this is driving me nuts.
The environment is:
- Ruby version is 1.8.6
- Rails version is 1.2.3.
- Database is Oracle (10g) in which I have a table with one 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.
Is there a reason Rails would override the value for a NUMBER(1,0)
field? Is it believing that the field is a true/false container and
changes the default to a 0 (zero) since it is not a 1 ('true')?
Any ideas why this is happening and/or how to solve it short of
modifying the column's length?
This is a new post for a message I didn't get any answers to. I hope
this post catches somebody's eye and helps me with the issue. Sorry
for the duplication but this is driving me nuts.
The environment is:
- Ruby version is 1.8.6
- Rails version is 1.2.3.
- Database is Oracle (10g) in which I have a table with one 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.
Is there a reason Rails would override the value for a NUMBER(1,0)
field? Is it believing that the field is a true/false container and
changes the default to a 0 (zero) since it is not a 1 ('true')?
Any ideas why this is happening and/or how to solve it short of
modifying the column's length?
Well the mysql adapter has a MysqlAdapter.emulate_booleans setting
that does that with tinyint(1) columns.
The oracle adapter could conceivably be doing the same thing - check
the source!