On Mon, Mar 9, 2009 at 6:48 AM, Frederick Cheung <[email protected] > wrote:
> > > On 9 Mar 2009, at 11:09, engamocap wrote: > > > > > Hi all, > > > > I have two tables: > > > > TABLE 1 > > A pk - fk (referencesc TABLE 2) > > B pk > > C pk > > D pk > > E > > F > > > > TABLE 2 > > A pk > > G > > H > > I > > L > > > > I don't use incremental field (id). I'd like don't use find_by_sql. > > How can I define both models to use correctly find method (with > > include)? With only one column primary key I haven't problems. > > I thought two solutions, but I don't like these very much (especially > > the second): > > > There (at least used to be) a plugin that added composite primary key > support to rails. I don't remember what it was called (never used it > myself) but you might be able to track it down. > > Fred > > > 1) modify TABLE 1 (add field id as primary key and define A,B,C,D as > > unique) and TABLE 2 (column A reference to field id of TABLE 1) > > 2) I use DB web interface only read mode (users cannot write and > > update) and then I can pretend (in model) that TABLE 1 primary key > > were only column A > > > > Can you help me? > > > > Thank you very much > > engamocap > > > > > > > Fred, I believe that you're talking about the following: http://compositekeys.rubyforge.org/ -Conrad --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

