我将模型分配给商店然后调用
var model = Store.create({id:0,firstName:"john",lastName:"smith",department:"sales"});
model.save();
这会发送PUT请求。不应该发送POST吗?我尝试不包括id字段,但它会抛出验证错误。我有什么想法吗?
答案 0 :(得分:0)
看起来您无法发送任何ID并将其POST。那么最好的方法就是
var model = Store.create({firstName: "john", lastName: "smith", department: "sales"});
Store.add(model);
或
var model = new MyModel({firstName: "john", lastName: "smith", department: "sales"});
Store.add(model);