Scaffolding and editing of numeric(xxx,0) columns

Hi.

I’m using Rails 1.2 and I’ve the following problem with the scaffold’s
editing form:

I’ve the following table (in PostgreSQL 8.1):

CREATE TABLE empleados
(
id serial NOT NULL,
emp_no numeric(4,0),
apellido varchar(10),
oficio varchar(10),
dir numeric(4,0),
fecha_alt date,
salario numeric(10,0),
comision numeric(10,0),
dept_no numeric(2,0),
CONSTRAINT empleados_pkey PRIMARY KEY (id)
);

I create a minimal application with “rails prueba”, I configure the
connection accordingly, and then:

prueba> ruby script/generate model empleado
prueba> ruby script/generate scaffold empleado admin

I check that all works very well. However, in the edit form, the numeric
fields appears with a decimal “.0”.

For example, the URL http://localhost:3000/admin/show/1 gives me the
following:

Emp no: 7369

Apellido: SÁNCHEZ

Oficio: EMPLEADO

Dir: 7902

Fecha alt: 1980-12-17

Salario: 104000

Comision:

Dept no: 20

Edit | Back

However, the URL http://localhost:3000/admin/edit/1 gives me a form with
the following fields & contents:

Emp no
7369.0

Apellido
SÁNCHEZ

Oficio
EMPLEADO

Dir
7902.0

Fecha alt
1980 December 17

Salario
104000.0

Comision

Dept no
20.0

Edit
Show | Back

As you can see, the numeric values in the edit form have a “.0” as
suffix, but this .0 is not in /admin/show, nor /admin/list, nor
database.

I get the following when I enter into the console:

$ ruby script/console
Loading development environment.

e = Empleado.find(1)
=> #<Empleado:0xb76caa54 @attributes={“apellido”=>“SÁNCHEZ”,
“dir”=>#BigDecimal:b76cab1c,‘0.7902E4’,4(8),
“emp_no”=>#BigDecimal:b76cab6c,‘0.7369E4’,4(8),
“dept_no”=>#BigDecimal:b76caa7c,‘0.2E2’,4(8), “oficio”=>“EMPLEADO”,
“id”=>“1”, “comision”=>nil, “fecha_alt”=>“17-12-1980”,
“salario”=>#BigDecimal:b76caae0,‘0.104E6’,8(12)}>
e.emp_no
=> 7369
e.emp_no.class
=> Fixnum

Anybody knows what’s the matter? How can I fix this irritating issue?

Thanks a lot.