Ember Data not finding model, while it is clearly there


#1

I have as many others upgraded my ember app to the newest version of anything, but after having upgraded, my app is still not working.

I have simplified a lot, and it boils down to my route. My route is like this (as suggested in the transition guide):

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

Extremely simple and nothing should be wrong, right? My model looks like this:

App.Box = DS.Model.extend({
  enabled: DS.attr('boolean'),
  updatedAt: DS.attr('date'),
  
  boxMeters: DS.hasMany('App.BoxMeter')
});

The App.BoxMeter is very similar, but they key thing is that all of this worked before I upgraded to 1.0.0.

I get a couple of errors thrown in my face. They are:

Assertion failed: No model was found for 'App.Box' ember.js?body=1:394

Error while loading route: TypeError {} ember.js?body=1:394

Uncaught TypeError: Cannot set property 'store' of undefined 

none of which makes any sense for me. I have looked over the routes and models countless times, and this is just … weird! How should I tackle this?


#2

I had something similar, worked once I changed DS.hasMany( “App.Model” ) to DS.hasMany(“model”). Changing this seemed to help me, hopefully it will help you too.


#3

There it is! Thank you!


#4

I had the same Issue, I strongly suggest reading this : https://github.com/emberjs/data/blob/master/TRANSITION.md You will see at the very bottom the new convention.