我收到错误
Uncaught TypeError: Object #<Object> has no method 'map'
当使用 ember-data 尝试从我的 api 加载 json 时。
App = Ember.Application.create({});
App.Student = DS.Model.extend({
primaryKey: 's_id',
s_id: DS.attr('integer'),
surname: DS.attr('string')
});
App.Student.reopenClass({
url: 'api/student.php'
})
App.adapter = DS.Adapter.create({
findAll: function(store, type) {
var url = type.url;
console.log(type.url);
jQuery.getJSON(url, function(data){
store.loadMany(type, data);
});
}
});
App.store = DS.Store.create({
revision: 4,
adapter: App.adapter
});
App.students = App.store.findAll(App.Student);
我已确保 JSON 格式正确,但无济于事;有任何想法吗?
谢谢