First page Back Continue Last page Overview Graphics


Notes:

One example of an association type it doesn't support natively is ActiveRecord's has many through has many association.

This association can easily be built using Sequel's toolkit. The key is the dataset option, which allows you to specify the dataset to use for the association.

In this example, each firm has many clients and each client has many invoices.

To get the invoices for the firm, you load all invoices where the client's firm is the current firm.

Eager graph eagerly loads the clients for each firm, so you also get the benefit of the client object for each invoice automatically being cached in the returned invoices.

You can create custom associations in ActiveRecord, but you need to write all the SQL by hand. That's painful enough, but what's worse is you can't eagerly load custom associations in ActiveRecord.