Shopify/identity_cache — pull request #126 by dylanahsmith (2014-02-26 20:41:54+00:00)
Title: Change cache key for non-embedded cache_has_many since they embed ids.

@fbogsany & @camilo for review

## Problem

Pull #120 made the assumption that cache_has_many with `:embed => false` will not embed anything for the association, when cache_has_many actually embeds the association's ids. This led to a regression where old cache values will be used after adding a non-embedded cache_has_many association.

A clearer API would require `:embed => :ids` to be used for this type of association, but that is a problem for another pull request.

## Solution

The cache key has a hashed schema string that includes the column names, their types, and the names and hashed schema string for all embedded associations in the format `#{name}:(#{denormalized_schema_hash(options[:association_class])})`.

For cache_has_many associations with `:embed => false` we will now add `#{name}:ids` to the schema string. Since we only embed the ids, we don't need to have it dependant on the columns or associations of this associated model.