* Use ancestry in the index and add test * Add tests for show action * Return complete comments trees for index, kill n+1 and use correct edge cache key * Return complete comments tree for show, kill n+1 and use correct edge cache key * Refactor tests and add surrogate keys tests * Preload users for the whole subtree * Clarify explanation of the edge cache keys construction * Refactor partials * Remove action caching * Replace .map.flatten with .flat_map * Fix surrogate key prefix according to Fastly docs * Add comment.purge to Comments::BustCacheJob to use Fastly-Rails * Fix surrogate key spec
4 lines
224 B
Ruby
4 lines
224 B
Ruby
json.array! comments.keys do |root_comment|
|
|
# ancestry organizes root comments and their descendants in a hash structure
|
|
json.partial! "comment_with_children", comment: root_comment, children: comments[root_comment]
|
|
end
|