Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Ember Data The REST Adapter

Error while processing route

I've already set up a rest service that returs proper json but as soon as I delete the two libraries from index.html and try to load the app again I get this error:

Error while processing route: mascotas Assertion Failed: The response from a findAll must be an Array, not undefined Error: Assertion Failed: The response from a findAll must be an Array, not undefined

mascotas is equivalent to the posts route that you've set up to be the home page

jadaml
jadaml
11,593 Points

Did you ever figure this out? If so, do you also happen to have it up on github?

2 Answers

Are you using an ArrayController where your JSON data is returning an object?

I fixed it by changing JSON object rails returns. It stores layout in app/views/posts/index.json.jbuilder Changing default to:

json.posts do
    json.array!(@posts) do |post|
      json.extract! post, :id, :title, :body
      json.url post_url(post, format: :json)
    end
end

solved my problem. All i did - added wrapping braces around result array. hope that helps.