Here is a demo, how to load a model with associations (in a single request) in canJS. I found it in the github repo of canJS, here, and actually I had to rewrite it a little bit to work (it was outdated), but it works now.
My problem is, that if I change a loaded contact (contact.attr('name', 'Tom');
), and then I want to save it (contact.save();
), then the contact, and also the contact's tasks will be posted via ajax to the server, to be saved. This is logical, because the tasks
is an attribute of contact
.
My problem is, that I only want the contact name
, birthday
and id
to be posted when updating a record. I probably should override the makeRequest
method, and remove tasks
before posting to server, but I thinks there should be a more elegant solution.
Hopefully there are some canJS users here, who handled this situation already.