cinderedMonkey
2008-Jul-02 21:55 UTC
legacy database and rails with its auto incrementing primary key problems
I''m sorta stuck as to what to do. I''m porting a legacy database where the primary key were not auto incrementing fields. An example create_table: components do |t| t.integer :componentid ... end and create_table: versions do |t| t.integer :versionid t.integer :componentid ... end The foreign key for table versions is componentid from table components. In MySQL, the primary key would be ''id'', an auto incrementing field. I would have liked to make componentid in components my primary key but seems rails does not like non-auto incrementing primary keys...so the question becomes how do I create the key relationship? I would like to be make searches along the lines of version=components.versions.versionid or some such. Am I making any sense? Thanks in advance, Hubert --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---