1
  • My model is var UserLookup = DS.Model.extend({ 'name': DS.attr('string') });

  • In My adapter I lookup as follows this.store.find('userLookup').then(function(results){ }

  • The response from REST API is {"userLookups":[{"id":1,"name":"xxx"},{"id":2,"name":"yyyy"}]}

Upon deserialization it fails with error Error: Assertion Failed: The response from a findAll must be an Array, not undefined

I made sure the model lookup and the key in JSON response are both camelCased. If I rename the model with a single word, everything works.

Am I missing something in serializer that could cause this error?

5
  • Did you register the model on your application variable, i.e. App.UserLookup = ...? Because I don't think it's going to work if you register it as a global. Commented Aug 8, 2014 at 9:55
  • I return the model from the router and this works if I rename the model to a single word. The problem arises only in case of models with multi word names. Commented Aug 8, 2014 at 16:18
  • Can you put a bin (emberjs.jsbin.com) showing the issue? Commented Aug 8, 2014 at 16:47
  • Have you tried returning { "user_lookups": [...] } as JSON, i.e. use snake case instead of camel case? Commented Aug 9, 2014 at 12:24
  • Are you using the Rest or ActiveModel serializer? If so, can you try debugging github.com/emberjs/data/blob/master/packages/ember-data/lib/… to see what type ED is trying to lookup for your "userLookups" key? Commented Aug 13, 2014 at 5:25

1 Answer 1

0

I believe the root key in the API response needs to user_lookups, not userLookups

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.