// User model.js
job: belongsTo('job')
// Job model.js
user: belongsTo('user')
// When saving relationship change
job.set('user', [a user model or null if removing the association between the two]);
job.save();
When using the default JSONAPI adapter, this type of record update does not default to the nested resource URL (/job/:job_id/relationships/user) and instead just uses /job/:job_id/.
I'm not sure if this is a symptom/side-affect of https://github.com/emberjs/data/issues/3467
Unfortunately this is not possible at the moment, as links are not fully supported yet. This is somewhat tracked in #2905 under Miscellaneous > Improve link handling.
I think this will be supported using references once RFC#160 (or similar) is implemented: job.belongsTo('user').save().
This is related to #3733, which is about saving hasMany relationships.
...
user: {
links: {
self: 'jobs/1234/relationships/user'
}
}
...
in our payload, correct?
@pangratz it seems like a major oversight, unless I've misunderstood this issue? From what I understand, If you take the example of posting and deleting comments on an article, there is no way currently to do this using relationship links, meaning the full array of all comments is sent in a PATCH request - unscalable and unusable.
@BenKingBBC I agree. We're running into major scalability issues by sending the array every time.
Closing this as we're tracking self link support in #2905 (I also updated that one to be a bit clearer on self link support for relationships)
Most helpful comment
Unfortunately this is not possible at the moment, as links are not fully supported yet. This is somewhat tracked in #2905 under
Miscellaneous > Improve link handling.I think this will be supported using references once RFC#160 (or similar) is implemented:
job.belongsTo('user').save().This is related to #3733, which is about saving
hasManyrelationships.