I have an ArrayController whose content is defined in a route like that:
App.UsersRoute = Ember.Route.extend({
model: function() {
return App.User.find();
},
setupController: function(controller, model) {
this._super(controller, model);
this.controllerFor('application').set('currentRoute', 'users');
}
});
And I list the data in a template:
<ul>
{{#each user in arrangedContent}}
<li>
{{user.lastName}} {{user.firstName}}
{{#linkTo "users.edit" user class="btn btn-primary btn-small"}}EDIT{{/linkTo}}
</li>
{{/each}}
</ul>
It works fine.
If I create a new item, it is automatically added to the list in the template:
App.UsersNewRoute = Ember.Route.extend({
model: function() {
return App.User.createRecord({firstName: '', lastName: ''});
}
});
But when I delete an item in a "edit" view, it doesn't work:
App.UsersEditController = Ember.ObjectController.extend({
...
destroy: function() {
this.get('content').deleteRecord();
this.get('store').commit();
this.transitionToRoute("users.index");
}
});
But in the "new" view, if I delete the new created item, it works (without the commit).
In the edit controller, if I remove the "commit", the list is updated, but when I do another action, the list is reloaded, and the deleted item reappears (normal).
So, how to delete an item?
NOTE: I use the "master" code of ember and ember-data, refreshed just now.