Trying to rollback after a deleted record seems to not restore the record to the hasMany relationship. I can see the record still exists in the canonicalState
array but the currentState
is always missing the record. How can i restore the record?
I have a model with a has many relationship
App.User = DS.Model.extend({
posts: DS.hasMany('post'),
});
App.Post = DS.model.extend({
body: DS.attr('string'),
user: DS.belongsTo('user')
});
I delete a post from the users model
user.get('posts').then(function(posts){
posts.objectAt(2).deleteRecord();
});
Then i roll it back after the user cancels the change.
user.rollback();
user.get('posts').then(function(posts){
posts.forEach(function(post){
post.rollback();
});
});
The posts array still has this state.
__ember1438618269274: null
__ember_meta__: Object
__nextSuper: undefined
canonicalState: Array[4]
currentState: Array[3]
isLoaded: true
isPolymorphic: undefined
length: 3
record: Class
relationship: ember$data$lib$system$relationships$state$has$many$$ManyRelationship
store: Class
type: my-app@model:post:
__proto__: Class