【发布时间】:2020-10-27 02:42:05
【问题描述】:
我认为有这个方案:
_user_data.html.erb:
<tbody>
<%= render partial: 'edit_history_inline_user', collection: @presenter.collection, as: :user, cached: Proc.new{|user| [acl_fingerprint, 'history', user.record] } %>
</tbody>
_edit_history_inline_user.html.erb:
<td class="align_center">
<%= user.first_name %>
</td>
<td class="align_center">
<%= user.last_name %>
</td>
...
问题是当我更新user 模型时,_edit_history_inline_user.html.erb 中的数据没有更新。但是,如果我在 _edit_history_inline_user.html.erb 文件中进行一些更改,例如(添加 -- 字符):
<td class="align_center">
-- <%= user.first_name %> --
</td>
将显示正确/最近修改的数据。这怎么可能?为什么修改后的数据显示不正确?
这是我在父部分视图中使用的acl_fingerprint 方法:
def acl_fingerprint
Rails.cache.fetch("#{current_admin.cache_key(:current_sign_in_at, :updated_at)}/acl_fingerprint", expires_in: 3.hours) do
CacheService.acl_fingerprint(current_admin, params[:controller])
end
end
我该如何解决这个问题?
任何帮助将不胜感激!
【问题讨论】:
标签: ruby-on-rails caching redis ruby-on-rails-5