Skip to content

need better method for detecting a collection #4

@jamesdixon

Description

@jamesdixon

The JSON API spec requires that requests for a single record are returned as an object. Alternately, requests for collections, even if the collection only contains a single records, should be returned as an array.

Unfortunately, there isn't a great way to detect whether data coming into the plugin needs to call fetch or fetchAll depending on whether the user is requesting a single record or collection. I tried a few hacky things looking at Model#attributes and the Model#query._statements, but alas I broke it a few times.

Need a better way to determine this. May just revert to a flag that should be passed to the method.

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