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 class="row comments">
|
||||||
<div id="comments" class="small-12 column">
|
<div id="comments" class="small-12 column">
|
||||||
<%= content %>
|
<%= content %>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user