Reputation: 4150
i'm using backbone method save to update user object on parse.com. object that in backbone are based on a model and collection. When i fetch it's all right but when save appear: PUT https://api.parse.com/1/classes/_User/xj3QLLYy07 400 (Bad Request)
{"code":206,"error":"Parse::UserCannotBeAlteredWithoutSessionError"}
Model:
var Person = Backbone.Model.extend({
urlRoot: "https://api.parse.com/1/classes/_User/",
idAttribute: "objectId",
defaults:{
},
initialize: function() {
console.log("inperson");
// this.upload();
}
});
return Person;
Collection:
var Usercollection = Backbone.Collection.extend({
model: Person,
url:'https://api.parse.com/1/classes/_User/',
parse: function(data) {
return data.results;
}
});
return Usercollection;
and the code where i try to save the model:
this.model.save({email:"[email protected]"}, {
// wait:true,
success:function(model, response) {
console.log('Successfully saved!');
},
error: function(model, error) {
console.log(model.toJSON());
console.log(error.responseText);
}
});
Upvotes: 0
Views: 222
Reputation: 9696
I think this answer needs an update. Cant you just swap the backbone collection and model to Parse's ones?
Here is a short example that worked for me today
Upvotes: 0