« All deprecation guides
Deprecation Guide for BelongsToReference.push(DS.Model)
until: 4.0.0
id: ds.references.belongs-to.push-record
feature: ds-overhaul-references
Passing an instance of
DS.Model
to
BelongsToReference#push
has been deprecated. You should instead follow the
pattern of model.set('relationship', value)
to update a belongsTo
relationship with an instance of DS.Model
.
For example, if you have something like:
let post = this.store.peekRecord('post', 123);
let author = this.store.peekRecord('user', 456);
post.belongsTo('author').push(author);
You can remove this deprecation by refactoring your code to:
let post = this.store.peekRecord('post', 123);
let author = this.store.peekRecord('user', 456);
post.set('author', author);