Only cache attributes for ActiveRecord objects

Optimize building the embedded_associations hash.