-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"included" key missing from response when object is same type #87
Comments
First, Not sure why the |
@caseyprovost I'm using |
@caseyprovost could you share your |
@dduqueti Check out these gists:
|
@dduqueti Join the slack channel and DM me :) I can help you through this. |
@dduqueti Hi, I encountered same issue, For example categories = Category.includes(:sub_categories).all # this is the problem line
render jsonapi: categories, include: [:sub_categories] The result of jsonapi does not have *Expected Result
*Real Result (SubCategory1-1 is not be included in Category1)
*Solution # only render the parent Category
categories = Category.includes(:sub_categories).all.where(parent_id: nil)
render jsonapi: categories, include: [:sub_categories] *Why not included ?
In my example SubCategory is already appeared in the |
Working through implementing includes I have discovered what appears to be a bug. All my other code like this works as expected and the only difference I can find is that the association is the same class as the requested object.
Controller
Serializer
The response looks nearly correct, except the includes are missing at the end. I have provided a sample below.
The text was updated successfully, but these errors were encountered: