1

我在控制台中四处寻找,以弄清楚缓存摘要依赖项是如何计算的。这适用于 app/views/posts/show.html.haml 模板:

ActionView::Digestor.new(name: "posts/show", finder: finder).digest
# => Cache digest for app/views/posts/show.html.haml: 42bf3496bacfcf84492d8c05d81305fe

这些都不适用于 app/views/posts/_post.html.haml 模板:

ActionView::Digestor.new(name: "posts/_post", finder: finder).digest
# =>  Couldn't find template for digesting: posts/_post
ActionView::Digestor.new(name: "posts/post", finder: finder).digest
# =>  Couldn't find template for digesting: posts/post

(对于两者,finder = ApplicationController.new.lookup_context

如何告诉 ActionView 寻找这个部分?

4

1 回答 1

1

根据源代码,我希望这可行:

ActionView::Digestor.digest(
  name:   'posts/_post', 
  finder:  finder,
  partial: true
)
于 2015-01-10T00:24:37.947 回答