I am trying to paginate some data from a model called D filtering results based on a specific condition from an indirectly related model. My models look like:
D->C->B->A (where each -> is a belongs to)
I want to paginate on the records of D where A.client = ?
Is this possible using containable? What is the preferred method of doing this (using containable from model D resulted in a query for each paginated item, which seems inefficient)?