Permalink
Browse files

Make sure __meta_version isn't treated like a potential property

  • Loading branch information...
1 parent 66547c5 commit 86ab4a76d5f728d13f9799c9042781a56f19abdf maritz committed Jul 3, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/retrieve.js
View
@@ -42,7 +42,10 @@ exports.load = function (id, callback) {
}
if (Array.isArray(keys) && keys.length > 0) {
for (p in values) {
- if (values.hasOwnProperty(p) && self.properties.hasOwnProperty(p)) {
+ var is_enumerable = values.hasOwnProperty(p);
+ var is_meta = p === '__meta_version';
+ var is_property = self.properties.hasOwnProperty(p);
+ if (is_enumerable && is_property && ! is_meta) {
value = values[p] !== null ? values[p].toString() : null;
if (self.properties[p].load_pure) {
self.properties[p].value = value;
@@ -51,8 +54,8 @@ exports.load = function (id, callback) {
}
return_props[p] = self.p(p);
self.__resetProp(p);
- } else if ( ! self.properties.hasOwnProperty(p)) {
- Nohm.logError('WARNING: A hash in the DB contained a key that is not in the model definition. This might be because of model changes or database corruption/intrusion.')
+ } else if ( ! is_meta && ! self.properties.hasOwnProperty(p)) {
+ Nohm.logError('WARNING: A hash in the DB contained a key ('+p+') that is not in the model definition. This might be because of model changes or database corruption/intrusion.')
}
}
self.id = id;

0 comments on commit 86ab4a7

Please sign in to comment.