In this jsfiddle, I have EmBlog.PostsNewRoute and EmBlog.PostsEditRoute. The routes contain events for 'save, cancel and destroy'.
When I create a new record, it only creates it in memory and never calls the store.commit() and in the console, it throws the error:
Uncaught TypeError: Cannot call method 'commit' of undefined
When I try to edit, it throws thesame error but then the edit still happens only in memory.
The destroy action also fails.
When I call cancel, I get:
Cannot read property 'defaultTransaction' of undefined
Most of the code is in the jsfiddle. The save and cancel events follow the pattern described by Yehuda here:
App.NewUserRoute = Ember.Route.extend({
model: function() {
return App.User.createRecord();
},
events: {
save: function(user) {
this.get('store').commit();
}
}
});
Thanks