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?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---