rails/cache_digests — pull request #48 by shuber (2013-05-25 17:49:15+00:00)
Title: Default to Cache::NullStore when ActionView::Base.cache_template_loading is disabled

I was a little confused about the digest caching behavior like the people discussing issues: rails/cache_digests#11, rails/cache_digests#13, and rails/cache_digests#24.

For my specific use case, I started using `fresh_when` calls but noticed that requests did not refresh when I made changes to templates and always returned `304` responses. I came across this [HackerNews post by jeremykemper](https://news.ycombinator.com/item?id=4874600) where he suggested using [rails/etagger](https://github.com/rails/etagger) to add the current action's template digest as a declarative ETag e.g.

```ruby
etag do
CacheDigests::TemplateDigestor.digest [controller_name, action_name].join('/'),
request.format.symbol,
lookup_context,
dependencies: view_cache_dependencies
end
```

This works great in production but template changes still aren't reflected in the development environment unless `ActiveSupport::Cache::NullStore` is used. This pull request simply updates the `CacheDigests::Engine` and sets `CacheDigests::TemplateDigestor.cache` to `NullStore` if `ActionView::Base.cache_template_loading` is disabled.