0
App.Friend = DS.Model.extend({
fid: DS.attr("Number"),
name: DS.attr("String"),
bills: DS.hasMany("bill", {async: true})
});
App.Bill = DS.Model.extend({
description: DS.attr("String"),
amount: DS.attr("Number"),
date: DS.attr("Date"),
friend: DS.belongsTo("friend")
});
我在我的余烬应用程序中有上述两个模型。我有如下路线定义如下将数据推入余烬对象
App.Router.map(function(){
this.resource("friends", function(){
this.resource("friend", {path: ":id"});
});
});
我需要添加账单给特定的朋友,当我在朋友详细视图。但我不能够得到那个特定型号的控制在我的FriendController
App.FriendController = Ember.ObjectController.extend({
actions: {
addBill: function() {
debugger;
}
}
});
我怎么能我的账单添加到特定的朋友在这种情况下
Thanks @ kingpin2k。我被this.get(“model”)返回的promise所困惑。 – Dhakchianandan