You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now Model.save only handle returned id field for newly created instances and assigns id field of current model instance with incoming data.
Why not handle other data then _id and if field in response is model attribute then extend (replace current attribute value) model instance with incoming data?
Case:
Model has children array that is added in web app. On server on a server each child is assigned with id, even if this ids will come response data, in front app children still won't have them. The only way to implement it to fully rewrite save method.
At least it would be better if save method returned server response as second argument of save callback to allow further actions with that data, without need of full overriding of model.save method.
The text was updated successfully, but these errors were encountered:
I think model already adds any other properties. Unfortunately, only jQuery's deferred seems to support multiple arguments when resolving. But, you can overwrite created or destroyed and get access to the jqXHR object:
Now Model.save only handle returned id field for newly created instances and assigns id field of current model instance with incoming data.
Why not handle other data then _id and if field in response is model attribute then extend (replace current attribute value) model instance with incoming data?
Case:
Model has children array that is added in web app. On server on a server each child is assigned with id, even if this ids will come response data, in front app children still won't have them. The only way to implement it to fully rewrite save method.
At least it would be better if save method returned server response as second argument of save callback to allow further actions with that data, without need of full overriding of model.save method.
The text was updated successfully, but these errors were encountered: