Update object

Updating an object is actually saving over the old object, in the next example we are going to use our "WY0DQyj9L6 " record, remember that each record is unique so please check your record before testing it out.

We are basically getting the "WY0DQyj9L6" record, setting new info and saving it:

var car = Simbla.Object.extend("Cars");
var query = new Simbla.Query(car);
query.get("WY0DQyj9L6", {

    success: function(car) {
      car.set("car_year", 2016);
      car.set("car_model", "new car");

        car.save(null, {
            success: function(car) {
                 alert("Update succeeded") ;
            },
            error: function(car, error) {
                 alert("Error - update failed" + error.message);
            }
        });
   },
   error: function(car, error) {
      alert("Error - The object was not retrieved successfully" + error.message);
   }
});