Ember data & super model

DEBUG: ------------------------------- ember.js:3916
DEBUG: Ember      : 1.7.0-beta.1+canary.3d383376 ember.js:3916
DEBUG: Ember Data : 1.0.0-beta.7.f87cba88 ember.js:3916
DEBUG: Handlebars : 1.1.2 ember.js:3916
DEBUG: jQuery     : 1.10.2 ember.js:3916
DEBUG: ------------------------------- 

I’m starting a very simple application and trying out ember-data. I’m not sure if this is a bug or something I’m doing wrong. In my route and model function I have @store.find('post', 1) which works great. But if I try changing this to find all my records with @store.find('post') I get this error Error while loading route: posts No model was found for 'super' Error: No model was found for 'super' I don’t know what super is? The error is coming from the function called modelFor: on line 9797 in ember.data.js. If I place a console.log(key) in this function I get the following output post, App.Post, super.

Below is the code I’ve got currently, its very basic:


App.Post = DS.Model.extend
    title: DS.attr('string')
    description: DS.attr('string')

Index Route

App.IndexRoute = Ember.Route.extend
    beforeModel: () ->
        @transitionTo 'posts',

Post Route

App.PostsRoute = Ember.Route.extend
    model: () ->


   namespace: 'api/v1'

Hopefully someone can help me spot the error.

It turns out that if your json response returns an empty array only you’ll get this error. So for example - http://emberjs.jsbin.com/baras/1/edit. My json response should be returning post: [] and not just [] as this is not the correct format for ember data. Once I changed the json to return post: [] everything worked as normal.

Good read: http://jsonapi.org/

1 Like