Duplicate queries while eager loading multiple associations

oi = o.order_items.includes(item: :photos)

does not mutate o.order_items, adding the includes to it: it returns a new array of objects that has the extra options applied.

You do o = Order.includes(order_items: {item: photos}).last in which case

o.order_items should not execute any queries


thanks a lot, that did it