Ember cannot find the methods findAll()and find()that I implemented in my Property model. Here are the errors I get:
TypeError: App.Property.findAll is not a function
and
Error: assertion failed: Expected App.Property to implement `find` for use in 'root.property' `deserialize`. Please implement the `find` method or overwrite `deserialize`.
My router is configured as follows:
App.Router = Ember.Router.extend({
showProperty: Ember.Route.transitionTo('property'),
root: Ember.Route.extend({
home: Ember.Route.extend({
route: '/',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('home', App.Property.findAll());
}
}),
property: Ember.Route.extend({
route: '/property/:property_id',
connectOutlets: function(router, property) {
router.get('applicationController').connectOutlet('property', property);
},
}),
})
});
And here is my model:
App.Property = Ember.Object.extend({
id: null,
address: null,
address_2: null,
city: null,
state: null,
zip_code: null,
created_at: new Date(0),
updated_at: new Date(0),
find: function() {
},
findAll: function() {
}
});
What am I doing wrong? Should these methods follow the ownership model or should they go somewhere else? Should I override the method deserialize()instead of using find()? But even if I use this workaround findAll(), it still won’t work, and I still get this first error.
Thanks for any help.
source
share