Created
May 23, 2021 16:54
-
-
Save UsamaAshraf/bc9303a07a14dfd621b46fc6385a6403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posts = Post.all | |
author_ids = posts.pluck(:author_id) | |
authors = User.where(:_id.in => author_ids) | |
# Somehow pass the author objects to the post serializer and | |
# map them to the correct post objects. Can't imagine what | |
# exactly that would look like, but probably not pretty. | |
render json: posts, pass_some_parameter_maybe: authors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment