Fwd: [Rails] is it possible for table intersection reference same table

On Thu, Jul 31, 2008 at 7:42 PM, Beta B.
<[email protected]

wrote:

table_mains = TableMain.find(:all,:include=>[:table_a, :table_b,
:photo])

It only return left join from table_b but not table_a

try this:

table_mains = TableMain.find(:all,
:include=> [:table_a, :table_b, :photo],
:joins => “left join table_a where table_a.id =
table_mains.table_a_id
left join table_b where table_b.id =
table_mains.table_b_id
left join photo pa where pa.id =
table_mains.photo_a_id
left join photo pb where pb.id =
table_mains.photo_b_id”)


Tim G.