Forum: Ruby on Rails RE: One To Many To Many

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Hogan, Brian P. (Guest)
on 2006-02-24 17:58
(Received via mailing list)
You can't as far as I know... (someone correct me if I'm wrong
But you can make it work.

Not tested but it's similar to something I did before.

In the client model, do this

	def line_items
        items =
        for order in self.orders
          items << order.line_items

Then you can do client.find(1).line_items

If that makes you cry because of performance reasons, then you might
want to replace that logic with a simple select statement and use
This topic is locked and can not be replied to.