backbone-documentmodel
Advanced tools
Comparing version 0.6.3 to 0.6.4
/** | ||
* | ||
* Backbone-DocumentModel v0.6.3 | ||
* Backbone-DocumentModel v0.6.4 | ||
* | ||
@@ -227,18 +227,23 @@ * Copyright (c) 2013 Michael Haselton & Aaron Herres, Loqwai LLC | ||
_.each(_.keys(attributes), function (attrKey) { | ||
if (attributes[attrKey] instanceof Backbone.Model || attributes[attrKey] instanceof Backbone.Collection) { | ||
omitList.push(attrKey); | ||
// #7 - Strange output on nested collection models toJSON() | ||
if (this.collection && this.collection.pseudoIdAttribute) { | ||
response = this.get('value'); | ||
} else { | ||
_.each(_.keys(attributes), function (attrKey) { | ||
if (attributes[attrKey] instanceof Backbone.Model || attributes[attrKey] instanceof Backbone.Collection) { | ||
omitList.push(attrKey); | ||
} | ||
}); | ||
// clear pseudo parent id reference. | ||
if (this.pseudoIdAttribute) { | ||
delete attributes[this.idAttribute]; | ||
} | ||
}); | ||
// clear pseudo parent id reference. | ||
if (this.pseudoIdAttribute) { | ||
delete attributes[this.idAttribute]; | ||
response = _.omit(attributes, omitList); | ||
_.each(omitList, function (omitKey) { | ||
response[omitKey] = attributes[omitKey].toJSON(); | ||
}); | ||
} | ||
response = _.omit(attributes, omitList); | ||
_.each(omitList, function (omitKey) { | ||
response[omitKey] = attributes[omitKey].toJSON(); | ||
}); | ||
} | ||
@@ -245,0 +250,0 @@ |
@@ -18,3 +18,3 @@ { | ||
"main": "backbone-documentmodel.js", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"license": "MIT", | ||
@@ -21,0 +21,0 @@ "repository": { |
# Backbone-DocumentModel [](https://travis-ci.org/icereval/backbone-documentmodel) | ||
A plugin to create entire Document structures with nested [Backbone.js](http://documentcloud.github.com/backbone) Models & Collections with `deep model` references and `event bubbling`. | ||
@@ -313,2 +312,6 @@ | ||
#### 0.6.4 | ||
- Fixes issue #7 nested array's toJSON() now returns the value. | ||
#### 0.6.3 | ||
@@ -315,0 +318,0 @@ |
@@ -0,0 +0,0 @@ $(document).ready(function() { |
@@ -1514,2 +1514,12 @@ $(document).ready(function() { | ||
}); | ||
test("#7 - strange output on nested collection models tojson()", 3, function () { | ||
var model = new Backbone.DocumentModel({ | ||
emails : ['foo@bar.com', 'whiz@foo.foo', 'haha@lol.joke'] | ||
}); | ||
model.get('emails').each(function (eml) { | ||
equal(eml.get('value'), eml.toJSON()); | ||
}); | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ (function() { |
@@ -0,0 +0,0 @@ $(document).ready(function() { |
@@ -0,0 +0,0 @@ // Backbone.js 1.0.0 |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ // Underscore.js 1.4.3 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
15734
337
592515
18