findAll()
Ember は、Property モデルに実装したandfind()
メソッドを見つけられないようです。ここに私が得ているエラーがあります:
TypeError: App.Property.findAll is not a function
と
Error: assertion failed: Expected App.Property to implement `find` for use in 'root.property' `deserialize`. Please implement the `find` method or overwrite `deserialize`.
私のルーターは次のように設定されています:
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);
},
}),
})
});
そして、ここに私のモデルがあります:
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() {
// ...
}
});
私は何を間違っていますか?これらのメソッドは Property モデルで使用する必要がありますか、それとも別の場所で使用する必要がありますか? deserialize()
を使用する代わりにメソッドをオーバーライドする必要がありますfind()
か? しかし、その回避策を使用してfindAll()
も機能せず、最初のエラーが発生します。
助けてくれてありがとう。