Eager loading

As of Lafcadio 0.9.3, you can use eager loading to pre-join requested domain objects. This reduces the number of SQL calls.

invoices_and_clients = Invoice.all( :include => :client )
# => "select * from invoices left outer join clients on invoices.client = clients.pk_id"

The :include argument works through DomainObject convenience methods such as DomainObject.all and DomainObject.get. It can also be used while creating a query by hand with Query.new.

iac_query = Query.new( Invoice, :include => :client )
# => "select * from invoices left outer join clients on invoices.client = clients.pk_id"