4
我为我的JSON API输出使用Jbuilder,现在我想使用Rails 3.2.13的'cache_digest'gem添加缓存。Rails缓存摘要和Jbuilder
它工作正常,缓存模板被创建并从缓存中读取,但问题是,如果我更改模型条目,如更改“标题”,它不会过期缓存,它仍然显示旧的标题。
这是我的JBuilder模板索引:通过RailsAdmin接口
json.cache! "news" do |json|
json.array!(@news) do |news|
json.id news.id
json.title news.title
json.excerpt news.excerpt
json.content strip_links news.content
json.image news.image
json.source news.source
json.published_at news.published_at
json.created_at news.created_at
end
end
我改变属性。