Merge branch 'develop' into clean-assets

This commit is contained in:
Alexandre BODIN 2019-12-17 09:12:22 +01:00 committed by GitHub
commit a9ff593b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,16 @@ const populateAssociations = (definition, { prefix = '' } = {}) => {
const populateBareAssociations = (definition, { prefix = '' } = {}) => { const populateBareAssociations = (definition, { prefix = '' } = {}) => {
return definition.associations return definition.associations
.filter(ast => ast.autoPopulate !== false) .filter(ast => ast.autoPopulate !== false)
.map(assoc => `${prefix}${assoc.alias}`); .map(assoc => {
if (isPolymorphic({ assoc })) {
return formatPolymorphicPopulate({
assoc,
prefix,
});
}
return `${prefix}${assoc.alias}`;
});
}; };
const formatAssociationPopulate = ({ assoc, prefix = '' }) => { const formatAssociationPopulate = ({ assoc, prefix = '' }) => {