Skip to content

Commit

Permalink
Fixed rename handling in Instance (missed because of previous typo)
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Dec 3, 2013
1 parent 3c5f362 commit c9d7a0a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ function Instance(collection, doc, options, isNew) {
});

var schema = {};
var renamed = [];
for (k in doc) {
schema[k] = false;
if(options.rename[k]) {
schema[k] = options.schema[options.rename[k]];
renamed.push(options.rename[k]);
}
else
schema[k] = false;
}

for (k in options.schema) {
if(renamed.indexOf(k) != -1) continue;
schema[k] = options.schema[k];
}

Expand Down

0 comments on commit c9d7a0a

Please sign in to comment.