What formats does ActionView::Digestor.new accept for name?

257 Views Asked by At

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?

1

There are 1 best solutions below

1
On

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

ActionView::Digestor.digest(
  name:   'posts/_post', 
  finder:  finder,
  partial: true
)