Hi Justin,
I am making a PUT request using can.Model functionality. When PUT request is sent to server it sends all the attributes along with the changed attribute.
-----code---
var Test = can.Model({
create:"POST http://localhost/evens",
update:"PUT http://localhost/evens/{id}"
},{});
can.fixture("POST http://localhost/evens",
function(request, response, headers){
response({id:8},'','',{"Access-Control-Allow-Origin":"*"});
})
can.fixture("PUT http://localhost/evens/{id}",
function(request, response, headers){);
response({id:""},'','',{"Access-Control-Allow-Origin":"*"});
})
var shopping = new Test({name:"Tom",desc:"Lorem Ipsum"});
shopping.save(function(saved) {
saved.attr('name', 'Jenna');
saved.save(); ///sends {id:8,name:'Jenna', desc:'Lorem Ipsum'} to server rather {name:'Jenna'}
});
------code----
I would like to know is this the existing behavior or my implementation is wrong.
Best Regards,
Sushil J
I am making a PUT request using can.Model functionality. When PUT request is sent to server it sends all the attributes along with the changed attribute.
-----code---
var Test = can.Model({
create:"POST http://localhost/evens",
update:"PUT http://localhost/evens/{id}"
},{});
can.fixture("POST http://localhost/evens",
function(request, response, headers){
response({id:8},'','',{"Access-Control-Allow-Origin":"*"});
})
can.fixture("PUT http://localhost/evens/{id}",
function(request, response, headers){);
response({id:""},'','',{"Access-Control-Allow-Origin":"*"});
})
var shopping = new Test({name:"Tom",desc:"Lorem Ipsum"});
shopping.save(function(saved) {
saved.attr('name', 'Jenna');
saved.save(); ///sends {id:8,name:'Jenna', desc:'Lorem Ipsum'} to server rather {name:'Jenna'}
});
------code----
I would like to know is this the existing behavior or my implementation is wrong.
Best Regards,
Sushil J