Skip to content

nested serializer? #1

@beno

Description

@beno

In the readme the nested example says:

def put_post(post)
  put :title, post.title
  put :body, post.body
  put :author, fullname(post.author.first_name, post.author.last_name)
  put :comments, CommentsSerializer.new(post.comments)  # <- offending line
end

However, the default Serializer class does not take an initializer argument, so this fails. I can add an initializer and an instance variable, but then I get unexpected results. So how do I do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions