documentcloud/backbone — Issue #871: Set-method in Backbone.Model fails for response objects with "attributes" property
Author: krebbl
Created: 2012-01-18 17:27:15+00:00
State: open

Our fix looks like this:

```javascript

Backbone.Model.prototype.set = function(attrs, options) {
// Extract attributes and options.
options || (options = {});
if (!attrs) return this;

// Removed this eval line, which causes data which will have a property attributes to get lost
// if (attrs.attributes) attrs = attrs.attributes;

// better do it the following way
if (attrs instanceof Backbone.Model) {
attrs = attrs.attributes;
}

...
};

```