0

From top to bottom I have the belongs_to relationship between my table , and well has_many from the other direction.

ReportTarget
Report
Manager
Organization

I want to do an eager load on these. I think I can go this deep but I am not aware of the syntax if want to go deeper, which is what I need. I want to go all the way from Organization to ReportTarget

@blah = Organization.includes([managers: :reports]).find(params[:id])

1 Answers1

2

try

@blah = Organization.includes(managers: { reports: :report_targets }).find(params[:id])
jvnill
  • 29,479
  • 4
  • 83
  • 86
  • Thanks, that worked great. Now I have to combine this with another table. I asked a new question in here, could you please take a look: http://stackoverflow.com/questions/15162805/navigating-through-relations-for-more-than-two-level-deep/15162849#15162849 –  Mar 01 '13 at 19:00
  • opps! Correct link is this one http://stackoverflow.com/questions/15164854/navigating-through-relations-on-two-paths-in-schema/15165565#15165565 –  Mar 02 '13 at 02:45