documentcloud/backbone — Issue #928: Model.save seems broken when used with option wait=true
Author: peymano
Created: 2012-02-02 08:29:59+00:00
State: open

When I do:

foobar = new Foobar({ name: "1"})
foobar.save({ name: "2" }, { wait: true })

...model's `save()` correctly calls `_validates` instead of `set`:

if (attrs && !this[options.wait ? '_validate' : 'set'](attrs, options)) return false;
var model = this;
...

...but then calls `sync()` with the original `model`:

return (this.sync || Backbone.sync).call(this, method, this, options);

...so what gets saved is `name` = "1", not "2" as I expected. Or maybe that's the intended behavior?!

It seems like you'd need to clone `model`, then `model.set(attrs)`, then `sync()`.