In some cases, incorrect partial processing is performed in Rails, a possible problem of fragment caching

I have a template that displays a list of events

<tbody> <%= render partial: 'event', collection: events, cached: true %> </tbody> 

Partial event :

 <% cache event do %> <tr> <td> Something </td> <td> <%= render 'identifiable_link_with_tag', identifiable: event.identifiable %> </td> </tr> <% end %> 

Partial identifiable_link_with_tag :

 <% cache identifiable do %> <span class="badge badge-info"><%= identifiable.type %></span> <%= link_to identifiable.identifier, identifiable %> <% end %> 

Now it is strange what follows. Sometimes in the event view, I notice that for some events, instead of identifiable_link_with_tag , another identifiable_link_with_tag displayed: _identifiable . This seems very strange, and on a page containing 25 events, this will only happen for 1 or 2 or 3 (or 0) events.

In short, it seems that sometimes it is mistakenly identified. I use caching of Rails fragments, so this can be a factor. Am I missing something or encountering a Rails error? This question is very difficult to reproduce in the development process, so it is difficult to debug.

+7
ruby-on-rails ruby-on-rails-5
source share

No one has answered this question yet.

See related questions:

94
The rails are partially machined by block
eleven
Fragment caching and heavy loading: how to get the best of both worlds?
3
Rails: routing error in partial AJAX playback
3
Rails: slow partial rendering when cache_classes false
one
Ruby on Rails - Is it possible to remove the "template tree digest" from the cache key?
one
Cached partial rails displayed twice in layout
0
Memcached and Rails Fragment Caching Problem
0
Cached Slice Never Expires
0
Rails 5.2.1 - Caching Models and Fragments
0
Broken Links When Caching Snippets in Rails

All Articles