I just started using async: true
on some of our associations and saw some great performance improvements, one thing that I noticed however, is that ember will do a separate request for each associated object, so if I’d get a Post
with some comments
id see this:
GET /posts/1
# => { ... comment_ids: [1,2]}
GET /comments/1
GET /comments/2
I noticed that I can use coalesceFindRequests: true
to get:
GET /posts/1
# => { ... comment_ids: [1,2]}
GET /comments?ids[]=1&ids[]=2
However, my backend already knows about these associations. It’s now also becoming a bit more difficult to make sure users can’t request any comment from this endpoint. What I would really like is if I would be able to do something like this:
GET /posts/1
# => { ... comment_ids: [1,2]}
GET /posts/1/comments
Do you think this makes sense?
Is anyone doing this, if so, could you point me in the right direction?