docbrown/app/views/api/v0/comments/_comment.json.jbuilder
rhymes bcd85452e9 Comments API: fix caching issues (#4744) [deploy]
* 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
2020-01-15 10:45:56 -05:00

6 lines
164 B
Ruby

json.type_of "comment"
json.id_code comment.id_code_generated
json.body_html comment.processed_html
json.partial! "api/v0/shared/user", user: comment.user