Magik.JsonView.render_relationships
You're seeing just the function
render_relationships
, go back to Magik.JsonView module for more information.
Render relationship field for struct. relationships
is a list of {field, view} for mapping render.
For each field, call function View.render()
to render json for relation object.
Example relationships:
relationships = [comments: CommentView, author: UserView]
Result of render_relationships(post, relationships)
equal to output of below code
%{
comments: CommentView.render_many(comments, CommentView, "comment.json"),
autho: UserView.render_one(author, UserView, "user.json")
}