给定 RESTful 服务器上的这些 JSON 数据模型
/用户
{"users":[
{"id":"1","first_name":"John","last_name":"Doe"},
{"id":"2","first_name":"Donald","last_name":"Duck"}
]}
/用户/1
{"user":
{"id":"1","first_name":"John","last_name":"Doe","account":"1"}
}
/帐户
{"accounts":[
{"id":"1","owned_by":"1"},{"id":"2","owned_by":"2"}
]}
/帐户/1
{"account":
{"id":"1","owned_by":"1","transactions":[1,17]}
}
以及这些 Ember 数据模型
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter.create({
url: 'http://api.mydomain.ca'
})
});
App.User = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
account: DS.belongsTo('App.Account')
});
App.Account = DS.Model.extend({
ownedBy: DS.belongsTo('App.User'),
transactions: DS.hasMany('App.Transaction')
});
我还需要编写哪些其他 ember 代码才能将数据加载到模型中,然后编写一个模板来输出用户名、帐户 ID 和帐户中的交易数量?