Fix crash in `id(model, property)`

Before this change, an attempt to save a model instance with a dynamic
property to a MySQL datasource crashed the application.

This commit fixes the implementation of `id(model, property)` to
correctly handle the case when the property is not described in the
model definition.
This commit is contained in:
Miroslav Bajtoš 2015-01-28 11:38:11 +01:00
parent f58d3c82e3
commit 1eb6d79b97
1 changed files with 1 additions and 4 deletions

View File

@ -104,10 +104,7 @@ Connector.prototype.idNames = function (model) {
*/
Connector.prototype.id = function (model, prop) {
var p = this._models[model].properties[prop];
if (!p) {
console.trace('Property not found: ' + model + '.' + prop);
}
return p.id;
return p && p.id;
};
/**