ActiveRecord comes with a #cache_key_with_version which creates a key built from the cache_key and version of the model.
cache_key is evaluated as the model name and id i.e. messages/12 and the version defaults to the updated_at timestamp.