fast_jsonapi
fast_jsonapi copied to clipboard
ObjectSerializer not working for single object
fast_jsonapi version: 1.5 The object serializer is working fine if an array of objects is passed to serializer:
def index
contents = Content.page params[:page]
render json: ContentSerializer.new(contents)
end
But it doesn't work for single object
def show
options = {}
options[:include] = %i[content_texts image_labels]
render json: ContentSerializer.new(@content).serializable_hash, status: 200
end
FYI #462
@SahSantoshh Since you haven't posted any issue backtrace or error.
I am guessing the Content model has :size attribute or method defined on it which causes the issue.
Try to use the new repo which doesn't have this issue https://github.com/jsonapi-serializer/jsonapi-serializer