反馈 貌似一个缓存的问题哟!

jarorwar · July 07, 2015 · Last by jarorwar replied at July 23, 2015 · 1782 hits

代码:

<% cache(["sidebar_for_node_recent_topics", topic.node_id, Time.now.strftime("%Y-%m-%d %H")]) do %>
  <%
  limit = [[topic.replies_count, 1].max, 20].min
  topics = Topic.where(node_id: topic.node_id).recent.not_in(id: [topic.id]).limit(limit)
  %>

  <% if topics.present? %>
  <div class="panel panel-default">
    <div class="panel-heading"><%= t("topics.node_recent_topics") %></div>
    <ul class="list-group">
    <% topics.each do |item| %>
      <li class="list-group-item"><%= link_to(truncate(item.title, length: 30), topic_path(item), title: item.title) %></li>
    <% end %>
    </ul>
  </div>
  <% end %>
<% end %>

本地随便测试了下,貌似正常。

没看懂

节点下话题和当前话题重复了。

自己推荐自己

You need to Sign in before reply, if you don't have an account, please Sign up first.