sxckna
Last Updated: February 25, 2016
·
665
· gregorym

Bring cache_digests to the action_caching

Snippet to use the cache_digest for the action caching. As soon as the index.html.erb is updated or any partials inside the file is updated, it will expire the cache.

caches_action :index, :cache_path => proc { |c|
  { 
    digest: CacheDigests::TemplateDigestor.digest('home/index', 'html.erb', c.lookup_context)
  }
}