Last active
August 29, 2015 14:07
-
-
Save mxrguspxrt/f57b637059d41ceb8263 to your computer and use it in GitHub Desktop.
Creating assocations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you have to have assocations defined and in view you can check isDirty | |
// it is automatically pushed to your assocation (in our case order) | |
actions: { | |
addOrderProduct: function() { | |
var order = this.get("controllers.order.model"); | |
var orderProduct = this.store.createRecord("orderProduct", {order: order}); | |
return orderProduct; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
orderProducts: DS.hasMany("orderProducts", {async: true}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order: DS.belongsTo("order", {async: true}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this file is automtically genereted, so you dont have to do it | |
model: function(params) { | |
this.store.find("order", params.order_id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment