1
我想我必须在这里丢失的东西如何Collection caching - 1.3.1工作。当我将cached: true
属性添加到渲染器时,不会在模型更改时刷新缓存。但是,如果没有此属性,它将按预期工作。Rails 5 - 集合缓存不刷新
attending.html.erb
<%= render partial: 'attending_item', collection: @attendees, locals: {reserved: true}, cached: true %>
_item_attending.html.erb
<% cache([attendee.user, attendee, reserved]) do %>
<li class="attendee_id_<%= attendee.id %> <%= reserved ? 'reserved' : 'confirmed' %>">
<%= image_tag(attendee.user.profile.avatar_url(:avatar), size: '25x25') %>
<%= attendee.user.full_name %>
</li>
<% end %>
的用户模型将通过touch: true
的剖面模型得到更新,所以当他们更新有头像例如:
belongs_to :user, touch: true
有人可以向我解释我缺少什么或不了解收藏缓存如何工作,也许这是一个错误Rails?