Hello, I was wondering how can I update the a belongTo relation of a model? Imagine a User and a Comment model. User hasMany Comment and a Comment belongsTo a User.
The administrator has a screen where he can edit a Comment and change from one User to another. This means that the belongsTo relation of Comment needs to change from User with id 1 to User with id 2.
What I have done so far is I have a select box with the two Users and the option value is the id of the User. When the user is changed the on=changed event on the select box is triggered and I call action on the component backend. From here I get the selected id and I try to set the Comment.user.id = selectedId. However this gives me the error "Error: Assertion Failed: A record's id cannot be changed once it is in the loaded state".
Can someone explain to me how this can be done please?