First page Back Continue Last page Overview Text


The first is the :dataset option, which can be used to create custom model associations.

The :dataset option takes a proc that is evaluated in the context of a model instance.

Let's say you have a database of firms, clients, and invoices. Each firm has many clients, and each client has many invoices.

Let's say you want to get all invoices for a given firm. You could do this using a standard many_to_many association, but here's how it could be done with a custom association.