I found a way to make my original schema work.  Single table
inheritance.  Define the associations on the subclasses, and you can
use a different foreign key in each subclass.  Works like a charm.

I'm still debating with myself about a more sophisticated schema like
the ones suggested though.

On Apr 9, 1:59 pm, Joe <[email protected]> wrote:
> Hi Michael-
>
> Thanks so much for the reply.  Those links were very helpful, and I
> especially enjoyed the one about gay marriage.
>
> So it seems like it would be very difficult to do what I originally
> wanted (create a new kind of association that works in a new way), and
> it would require an understanding of rails internals and a lot of
> work.  The upshot is that if I think I need to change rails, I'm
> probably wrong, and I just need to change my schema to conform to best
> practices.
>
> So I will take the advice, and alter the schema to fit with rails
> better.  And following tips I got from those articles, it will have
> more flexibility too, though I think it will also have much more
> complexity than I had originally expected.  I'm still nailing down my
> perfect schema, but I think I'm getting close.
>
> Thanks for your advice
> Joe
>
> On Apr 8, 3:54 am, Michael Pavling <[email protected]> wrote:
>
>
>
> > On 8 April 2010 08:07, Joe <[email protected]> wrote:
>
> > > My schema looks like
>
> > >  create_table "people", :force => true do |t|
> > >    t.string   "name"
> > >    t.string   "sex"
> > >    t.integer  "father_id"
> > >    t.integer  "mother_id"
> > >  end
>
> > PS Here's a couple of links to DB designs for family 
> > relationships:http://www.familyhistorysa.info/dbDesign.htmlhttp://www.databaseanswe...
>
> > And here's one for modelling marriages (not strictly what you're
> > talking about, but the principle of husband/wife not being as simple
> > as first thought is similar to your issue with 
> > mother/father):http://qntm.org/gay

-- 
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.

Reply via email to