Shopify/identity_cache — pull request #16 by camilo (2013-03-22 05:37:19+00:00)
Title: Fix embeded association schema change

# Problem

Embedded associations that had not expired will cause a ``` ActiveModel::MissingAttributeError``` on schema changes if a newly added column is accessed.

The cause for this is that when the object we cached there was not instance variable ready to store the value of the new column.

# Solution

Calculate a hash of the schema of the association table, and keep it in another instance variable, compare on every fetch if the schema hash is different form the one store in the cache, do not blindly read

@hornairs @boourns @jduff

Should I drop the double ivar and have an object EmbededCacheEntry ? I kind of like that we have the hash and the cached thing no extra allocation or GC or stack but it is kinda ugly as is.