I''m writing a rails application that uses a legacy database that is imported. The legacy database has primary keys like "appno". The new structure in rails is going to be "id, company_id, appno" so there may be more than one record with the same appno, but each having a unique company_id, appno pair. id will be completely unique. The joined record will have the structure "id, company_id, jobno, appno" where company_id and jobno form a unique pair, and id is unique. I want to say that the job belongs_to :applicant, :foreign_key => "appno", :primary_key => "appno", :conditions => ["company_id = ?", self.company_id] so that it won''t use the id field on the applicant record but will instead use the appno field. Is it possible to do this? -- *Jeremy Wells* Serval Systems Ltd. www.servalsystems.co.uk <http://www.servalsystems.co.uk> Tel: 01342 331940 Fax: 01342 331950 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---