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

need better method for detecting a collection #4

Closed
jamesdixon opened this issue Apr 15, 2016 · 0 comments
Closed

need better method for detecting a collection #4

jamesdixon opened this issue Apr 15, 2016 · 0 comments

Comments

@jamesdixon
Copy link
Contributor

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.

jamesdixon added a commit that referenced this issue Apr 15, 2016
remove automatic detection of collections (fixes #4)
alechirsch added a commit that referenced this issue Dec 7, 2017
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

1 participant