I create a record like this:
var post = this.store.createRecord(‘post’, { id:UUID() }); // without save // post.save();
How can I delete the ‘post’ record? Did the record saved in the store? If I call the store.commit function, Will the new record request the server to save.
You can remove that newly created record that hasn’t been saved by doing this:
model.rollback(); if (model.get('isNew')) { model.deleteRecord(); }
Here’s a link that might help you out as well: http://reefpoints.dockyard.com/2014/03/03/a-simple-ember-data-route.html
You can use rollback.
post.rollback()
If model is new, it will be removed from the store.
Thanks, barryofguilder and midd, that’s helpful for me.