Shopify/identity_cache — pull request #98 by byroot (2013-11-28 16:13:20+00:00)
Title: fetch_multi association preloading mark associations as loaded to prevent N+1 queries

Previously associations were not marked as prefetched.

So any has_one association correctly prefetched but null, was triggering a N+1 query.

I tested this branch locally on orders controllers, it got rid of all remaining N+1 queries (~25 queries for 5 orders).

/cc @camilo @hornairs

My only concern is that non-embeded associations should not be marked as loaded on cache miss. But I don't have the full picture here.