Skip to content

How to include nested associations? #968

Closed
@piotrpalek

Description

@piotrpalek

Hey, let's say I have a Post model which has_many :comments. And I use it like this in the post index controller: render json: post, include: ['comments']. That works fine and includes the comments, but let's say the Comment model belongs_to :user now. Writing render json: post, include: ['comments', 'user'] doesn't "sideload" the data, is there a solution to this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions