Skip to content
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

ObjectSerializer not working for single object #472

Open
SahSantoshh opened this issue Aug 15, 2020 · 2 comments
Open

ObjectSerializer not working for single object #472

SahSantoshh opened this issue Aug 15, 2020 · 2 comments

Comments

@SahSantoshh
Copy link

SahSantoshh commented Aug 15, 2020

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
@davidwparker
Copy link

FYI #462

@abhikanojia
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants