diff --git a/app/models/post.rb b/app/models/post.rb index 36b36e2..e3ada41 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -75,10 +75,21 @@ class Post < OpenStruct 'posts/' + uuid.value end + def cache_version + updated_at.utc.to_s(:usec) + end + + # Agregar el timestamp para saber si cambió, siguiendo el módulo + # ActiveRecord::Integration + def cache_key_with_version + cache_key + '-' + cache_version + end + # TODO: Convertir a UUID? def id path.basename end + alias to_param id def updated_at File.mtime(path.absolute)