diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 3d795bcf..001075a9 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -1431,8 +1431,9 @@ RelationDefinition.embedsMany = function hasMany(modelFrom, modelTo, params) { if (item instanceof modelTo) { if (!item.isValid()) { hasErrors = true; + var id = item[idName] || '(blank)'; var first = Object.keys(item.errors)[0]; - var msg = 'contains invalid item: `' + item[idName] + '`'; + var msg = 'contains invalid item: `' + id + '`'; msg += ' (' + first + ' ' + item.errors[first] + ')'; this.errors.add(relationName, msg, 'invalid'); }