Possible to run only one query???

Hi all,

I'm hoping that someone out there knows a more efficient way to run a
query on a model with multiple levels of belongs_to's. I'm working on
a property management application, and the models I have are
Properties, Units, and Leases.

Property ---(has_many)--> Units
Units <-- (has_and_belongs_to_many) --> Leases

Leases have two date fields: starts_on, and ends_on, as well as an
integer field called square_feet.

My goal is to figure out the percentage of a property that is leased.
I'm currently doing it with a couple of functions in the property and
unit models. These are:


Take a look into :include, which tells ActiveRecord to preload the specified association(s). Something like

results = self.leases.find(:all, :conditions => [], :include => [<associations to include>])