Skip to content

.represent() does not work with collections and JSON API #187

@promisedlandt

Description

@promisedlandt

I'm trying to use Trailblazer to create a JSON API backend. Unfortunately, I can't get collections to work at all. This might be a mistake on my part, but I think I've tracked it down representable (but I'm not 100% sure).

What it boils down to is that .represent() does not work in JSON API when it's handed a collection.

This works:
Author::Representer::Index.for_collection.new(Author.all).to_json

This does not work:
Author::Representer::Index.represent(Author.all).to_json

I think that should work, right?

I have created a very simple Rails application to demonstrate:
https://github.com/promisedlandt/trailblazerjsonapi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions