1

I'm poking around in the console to figure out how cache digest dependencies are calculated. This works for the app/views/posts/show.html.haml template:

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

Neither of these work for the app/views/posts/_post.html.haml template:

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

(for both, finder = ApplicationController.new.lookup_context)

How can ActionView be told to look for this partial?

John Bachir
  • 22,495
  • 29
  • 154
  • 227

1 Answers1

1

According to the source code I would expect that this works:

ActionView::Digestor.digest(
  name:   'posts/_post', 
  finder:  finder,
  partial: true
)
spickermann
  • 100,941
  • 9
  • 101
  • 131
  • Thanks for your answer. When testing this I encountered this issue, maybe you have some thoughts: https://github.com/rails/rails/issues/18595 – John Bachir Jan 19 '15 at 04:28