Merge pull request #2201 from greatwitenorth/patch-3

Fixes Cannot read property 'toJSON' of null
This commit is contained in:
Jim LAURIE 2018-11-05 17:21:04 +01:00 committed by GitHub
commit 39ac9ec95a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,7 +184,7 @@ module.exports = {
withRelated: populate || this.associations.map(x => x.alias)
});
const data = record.toJSON ? record.toJSON() : record;
const data = _.get(record, 'toJSON()', record);
// Retrieve data manually.
if (_.isEmpty(populate)) {