On Feb 23, 10:18 am, Sandeep <[email protected]> wrote: > hi, > I am a relative newbie to using sequel - please be kind. > > I have already gone through a previous post on a related > topic:http://groups.google.com/group/sequel-talk/browse_thread/thread/3deb4...
That's over 3.5 years old, and much has changed since. > I am inheriting a legacy app that has MyISAM tables which use Foreign > Primary Key (or Primary Foreign Key..). For example, table Main has an > auto-increment primary key called "id" and table Derived has a primary > key called "id" which is a foreign key (remember... MyISAM) into Main. > Yes, Main and Derived are of the same size. > > Now, I need to create new Main and Derived records - I am not sure how > to add Derived as an association to Main, such that Derived's primary > key becomes Main's foreign key. I tried adding a one_to_one, but no > help. > > Could someone help please ? In this particular case, I think this will work: Main.many_to_one :derived, :key=>:id Derived.many_to_one :main, :key=>:id You could use one_to_one as well, but many_to_one is simpler and should work. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
