Extract method in comments component
This commit is contained in:
@@ -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 id="comments" class="small-12 column">
|
||||
<%= content %>
|
||||
|
||||
@@ -6,4 +6,17 @@ class Shared::CommentsComponent < ApplicationComponent
|
||||
@record = record
|
||||
@comment_tree = comment_tree
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user