Rails cache caching error for interpolated partial names

I have an application on which I have significantly improved response time using caching.

I am the caching fragments of a Russian doll, and one fragment represents a pair of (nested) particles. Everything seems to work as it should, but some of my included scores are made from an interpolated string. For those partial, I get a caching error in the error log:

Could not find template for digestion: path / to / # {my.calculated.partial.name}

I spent some time at Google, and the only thing I find is that many people want the digest to turn off. So I have a few questions:

  • Is there a way to fix this specific problem? (i.e. with cache digests for the actual "evaluated" partial names)?

    • I can imagine the answer to this is โ€œno,โ€ since the cached version of the page does not execute any code, and therefore the interpolated lines cannot
  • More general: why do I need to enable or disable caching? What is their purpose?

  • How would you advise me to get around these errors (if they are not solved 1)?

Update:

As requested, an example view that gives me this error would be:

-cache ['survey', @survey], expires_in: expire_period [...] -cache ['survey_questions', @survey] -@survey.questions.each do |q| =render "field_types/#{q.field_type.type.underscore}", question: q, f: f 

For example, if the field type is "text input", it displays field_types / _text_input.html.haml . All of this works great. The error I would get in my log:

_Couldnt find a template for digesting: field_types / field_types / # {q.field_type.type.underscore} _

+5
source share

Source: https://habr.com/ru/post/1208294/


All Articles