-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking change in Ember Data 3.2: Can no longer create a relation and persist it #5728
Comments
Essentially, the problem is that #5317 didn't consider the case of client-generated IDs. Some hacks that might work, or might cause more problems: // model:tls-domain
isDeleted: computed(() => false),
isLoaded: computed(() => true),
isLoading: computed(() => false),
isNew: computed(() => false),
isReloading: computed(() => false),
isSaving: computed(() => false), or const newTlsDomain = this.store.createRecord('tls_domain', {
id: domainName,
isNew: false,
}) |
Last option: |
well, |
Yikes, sorry about that @psbanka ! If you're building a record that's not new, in other words it has an ID that the backend would know what to do with, then I would recommend using You can also override |
@ryanto – |
Description
Prior to Ember Data 3.2, it used to be possible, given the following models:
to do the following:
That would produce the following (valid) JSON-API payload to the server:
However, due to this pull-request: #5317 from @ryanto
Ember Data now refuses to serialize the object that has not yet been persisted to the server, and now we get the following payload:
It seems to me that this is a breaking API change and should have been delayed until the 4.x release (although this is a PR from about a year ago, so that ship has probably already sailed). It also seems to be a useful feature in Ember Data to be able to construct an API request in this fashion without necessarily saving other records off to the database.
The text was updated successfully, but these errors were encountered: