rails: Couldn't find template for digesting: Error when calling a dynamically named partial
I am having an issues when trying to cache dynamically named partials which include static content
In site.html.erb I call:
<% cache("#{@site.name}_#{locale}", :expires_in => 2.hour) do %>
<%= render partial: "my_#{@site_name}_#{locale}" %>
<% end %>
Error
Couldn't find template for digesting: pages/my_#{@site_name}_#{locale}
Cache digest for app/views/pages/site.html.erb: 493b4a427278b191dc524264e105ea52
The partial is located in the same directory as site.html.erb
and is e.g. named as follows: pages/_my_nice_page_en.html.erb
or pages/_my_nice_page_de.html.erb
It looks like if rails looks at the wrong place for partials and or does not evaluate the dynamic string assignment and thus can’t assign a digest to a missing partial and thus cannot cache the partials.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
Has anyone found an fix or work around for this? It seems like it is happening in other places now too, not just partials.
Just for the record, it looks like this issue was solved here: bb048147912d7ea8c301acd6468e9f869dd0acad.
Would be nice to be able to exclude a partial from this digest builder, rather than just be trained to ignore the log messages. Not to mention bypassing the digest tap+rescue block.