I'm trying to get a app to work using the ember data 1.0 beta release and having issues getting the route to trigger a find the associated models loaded from a server.
Here's what my objects look like:
App.Technician = DS.Model.extend({
first_name: DS.attr(),
last_name: DS.attr(),
name: function(){
return this.get('first_name')+' '+this.get('last_name');
}.property('first_name', 'last_name')
});
App.TechniciansRoute = Ember.Route.extend({
model: function() {
return this.get('store').find('technician');
}
});
However when the technicians route tries to load the model the this.get('store').find() always throws an exception that find is not defined. I've debugged into it and hit the following function
store: Ember.computed(function(){
var container = this.container;
var routeName = this.routeName;
var namespace = get(this, 'router.namespace');
return {
find: function(name, value) {
var modelClass = container.lookupFactory('model:' + name);
Ember.assert("You used the dynamic segment " + name + "_id in your route "+ routeName + ", but " + namespace + "." + classify(name) + " did not exist and you did not override your route's `model` hook.", modelClass);
return modelClass.find(value);
}
};
})
modelClass is an reference to App.Technician which does not have find() defined on it, and hence the execption is throw.
Does anyone have any ideas? it feels like I'm missing something simple but I can't figure out what it is.