Eager loading issue

I have three tables, Invoices, Projects, and Managers.

Each manager has many projects. Each project has many invoices.

When displaying a list of the invoices, I am using:

Invoice.find(:all, :include => [:project])

Since the list shows information from the project table. (For
example, a table showing Invoice Date, Project Name). However, I’d
also like to show the manager name. Theoretically, i’d like to be
able do an eager loading of both :project, and :manager. Right now,
my list generates an individual SQL query for each invoice to display
the manager name. Trying to do :include => [:project, :manager]
obviously doesn’t work, as the manager_id is linked into the Projects
table, not Invoices.

In this case you should fall back to using find_by_sql method.