Permalink
Browse files

only cache notes if a post has notes

  • Loading branch information...
r888888888 committed Nov 21, 2017
1 parent 5b3f362 commit 3e6cb67c575a06cd7b6a1ba3939973e65eec11c1
Showing with 4 additions and 2 deletions.
  1. +4 −2 app/views/posts/show.html.erb
@@ -102,8 +102,10 @@
</section>
<section id="notes" style="display: none;">
<% cache("p/#{@post.id}/n/#{@post.last_noted_at.to_i}") do %>
<%= render :partial => "notes/note", :collection => @post.notes.active %>
<% if @post.has_notes? %>
<% cache("p/#{@post.id}/n/#{@post.last_noted_at.to_i}") do %>
<%= render :partial => "notes/note", :collection => @post.notes.active %>
<% end %>
<% end %>
</section>

0 comments on commit 3e6cb67

Please sign in to comment.