Hello,
We've run into an issue with a model that uses a natural key for the id.
The issue can be summed up as:
If a record is created, then deleted, then a new record created with same natural key as previously deleted record, we get error.
Assertion Failed: 'natural-key-model' was saved to the server, but the response returned the new id 'foo|bar', which has already been used with another record. (ember-data 2.17.0-beta.1)
It seems like the ember-data store is retaining a reference to the supposedly deleted record which prevents a new one from being created.
It is explained more here
Does ember-data support natural key's or is it something ever talked about? Or, am I off and the issue from above link is unrelated to natural key?
Thanks
Hi @erichonkanen. This seems like a bug and it is something Ember Data should support.
@bmac thanks for the input, I'm not entirely familiar with the intimate details of ember-data but do you think a work-around is possible? also where in the code would a new feature for this target? I'd be interested to get more familiar and possibly contribute
This looks like a duplicate of the unloadRecord open issues.
@erichonkanen Here is a work around for now: https://github.com/emberjs/data/issues/4972#issuecomment-336662752
@hjdivad @workmanw I just reverted our app to ember-data 2.12.1 after spending many hours trying to work around this issue and when I revert back to 2.12.1 our app works with no errors! not sure what happened after 2.12+... the issue happens when we remove a record that belongs to a model.hasMany and uses a composite id (natural key), and then we try to create a new record using the same composite id... so for now we have to go back to 2.12 until things stabilize :D
@bmac @hjdivad checking in if there has been any discussion on this issue? still outstanding as of 2.18.0-beta.1
```
"Assertion Failed: 'friendship' was saved to the server, but the response returned the new id 'burrito|taco', which has already been used with another record.'"
Closing this in favor of #1829
Most helpful comment
@hjdivad @workmanw I just reverted our app to
ember-data 2.12.1after spending many hours trying to work around this issue and when I revert back to2.12.1our app works with no errors! not sure what happened after 2.12+... the issue happens when we remove a record that belongs to amodel.hasManyand uses a composite id (natural key), and then we try to create a new record using the same composite id... so for now we have to go back to 2.12 until things stabilize :D