Only cache attributes for ActiveRecord objects

Replace use of VERSION with a new CACHE_VERSION constant.