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 Ember Data with Local Storage

Alex Lumierre
Alex Lumierre
11,010 Points

"No model was found for 'post' where it was clearly there & Uncaught ReferenceError: DS is not defined

I was using ember local data for the post... I have post.js inside my model, I've followed each step and it was the same, however, when I run the application it throws and error:

Error while processing route: posts.index" "No model was found for 'post'" "EmberError@http://localhost:3000/libs/ember.js:13538:17

And here is my models/post.js: Blogger.Post = DS.Model.extend({ title: DS.attr(), body:DS.attr() });

should I create one for posts as well?

1 Answer

Nicolas Sandller
Nicolas Sandller
5,643 Points

You need to call post.js on the model hook in the route.รง

It would look something like this:

App.PostRoute = Ember.Route.extend({
  model: function() {
    return this.store.find('post');
  }
});

for more information look  : http://guides.emberjs.com/v1.13.0/models/