Merge pull request #494 from tgriesser/fix-tojson

fixes incorrect toJSON extension, for eager loaded models
This commit is contained in:
Hannah Wolfe 2013-08-22 11:00:55 -07:00
commit 880de6bde6

View File

@ -35,8 +35,8 @@ GhostBookshelf.Model = GhostBookshelf.Model.extend({
return attrs;
}
_.each(relations, function (key) {
attrs[key] = relations[key].toJSON();
_.each(relations, function (relation, key) {
attrs[key] = relation.toJSON ? relation.toJSON() : relation;
});
return attrs;