Skip to content

Instantly share code, notes, and snippets.

@mxrguspxrt
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxrguspxrt/f57b637059d41ceb8263 to your computer and use it in GitHub Desktop.
Save mxrguspxrt/f57b637059d41ceb8263 to your computer and use it in GitHub Desktop.
Creating assocations
// 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;
}
}
orderProducts: DS.hasMany("orderProducts", {async: true}),
order: DS.belongsTo("order", {async: true}),
// 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