nytimes / backbone.trackit

Manage unsaved changes in a Backbone Model.
202 stars 33 forks source link

Reset tracking before calling callback on model in save method #18

Open kirach opened 9 years ago

kirach commented 9 years ago

Model tracking should be reset before calling old success callback during save method. For now, this example from documentation doesn't work:

model.save({}, {
    success: function() {
        console.log(model.unsavedAttributes());  // >> false
    }
});

because we call success and then reset tracking. This PR solve this problem.

Thanks.