Compound documents not showing up
Hey there guys.
I've been trying to use the compound document serialization, but for some reason things aren't working.
I have a number of models that are being serialized by the gem. This is what they look like:
class Shift < ApplicationRecord
belongs_to :team, optional: true
...
class Team < ApplicationRecord
has_many :shifts
...
This is what the serializer looks like
class ShiftSerializer
include FastJsonapi::ObjectSerializer
...
belongs_to :team
...
end
The serialization works. However, even though I am including the compound team document:
def index
shifts = policy_scope(Shift)
options = {}
options[:include] = [:team, :'team.name', :'team.color']
render json: ShiftSerializer.new(shifts, options)
end
I'm still getting the object formatted like so:
...
relationships: {
team: {
data: {
id: "22",
type: "Team"
}
}
}
Whereas I'm expecting to get also the attributes of my team model.
Did you find a fix for this?
Having this exact issue myself... hopefully I can find a fix.
It seems Netflix has abandoned this project. The community created a new fork to continue supporting this project. Please refer https://github.com/fast-jsonapi/fast_jsonapi