rails-api/active_model_serializers — pull request #307 by guenin (2013-05-21 18:14:48+00:00)
Title: Cache Serializer#attributes instead of #serializable_hash

This attempts to fix the caching bug described in rails-api/active_model_serializers#262.

The #serializable_hash method is not safe to cache because it has the side-effect of calling #include_associations!. Subsequent cache hits will fail to include the associated records.

This PR moves the caching down to the #attributes method. It does not change the caching on #to_json.

The failing test in #262 passes with this change.