I have several legacy tables which is not compatible with RAILS
TABLENAME CONVENTION.
So I have to use set_table_name, set_primary_key, set_sequence_name
functions when I define Model.
Let me say, Table looks like this…
OBJECTS => table name
object_id => primary key
.
.
(columns)
.
and sequence name is objects_id_seq.
When I save new row, I’ve got ‘Duplicate Comlumn Error’ on Insert SQL.
The reason was that when Rails make Insert SQL it doesn’t know
‘object_id’ is set to be primary key.
In above case, it makes SQL like this
INSERT INTO OBJECTS(OBJECT_ID, OBJECT_ID, …) VALUES(nil, :id, …)
I think One from field introspection and One from primary key…
How could I solve this?