Extract method in comments component

This commit is contained in:
Javi Martín
2021-06-26 21:53:32 +02:00
parent c3e0a6b089
commit beb24670ab
2 changed files with 14 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
<% cache [locale_and_user_status, current_order, commentable_cache_key(record), comment_tree.comments, comment_tree.comment_authors, record.comments_count] do %> <% cache cache_key do %>
<div class="row comments"> <div class="row comments">
<div id="comments" class="small-12 column"> <div id="comments" class="small-12 column">
<%= content %> <%= content %>

View File

@@ -6,4 +6,17 @@ class Shared::CommentsComponent < ApplicationComponent
@record = record @record = record
@comment_tree = comment_tree @comment_tree = comment_tree
end end
private
def cache_key
[
locale_and_user_status,
current_order,
commentable_cache_key(record),
comment_tree.comments,
comment_tree.comment_authors,
record.comments_count
]
end
end end