Forum: Ruby on Rails N:M:K Relationships

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A0fdde9231afc79ff35cb186690d087c?d=identicon&s=25 Roland Mai (roland)
on 2006-04-18 21:21
Hello there,

I was wondering whether rails 1.1.1 supports N:M:K relationships that is
having a pivot table with three columns which are primary keys:

  say, (apple_id, orange_id, lemon_id)

It would be so great if Rails could be able to have id-s which as
n-tuples.

Thanks,

Roland
675475d0b65710be6d992eb5eb2c61c2?d=identicon&s=25 Gregory Seidman (Guest)
on 2006-04-18 21:37
(Received via mailing list)
On Tue, Apr 18, 2006 at 09:21:51PM +0200, Roland Mai wrote:
} Hello there,
}
} I was wondering whether rails 1.1.1 supports N:M:K relationships that
is
} having a pivot table with three columns which are primary keys:
}
}   say, (apple_id, orange_id, lemon_id)
}
} It would be so great if Rails could be able to have id-s which as
} n-tuples.

I wouldn't expect it to ever support n-way relationships directly. You
can,
however, do this:

AOL
belongs_to :apple
belongs_to :orange
belongs_to :lemon

Apple
has_many :aols

Orange
has_many :aols

Lemon
has_many :aols

Also, I believe you can use has_many :through to get to the other
objects
more directly.

} Thanks,
} Roland
--Greg
This topic is locked and can not be replied to.