@@ -204,6 +204,11 @@ module.exports = class FootprintService extends Service {
204204 return query . catch ( manageError )
205205 }
206206
207+ _findNativeAssociation ( model , childAttributeName ) {
208+ return model . associations [ childAttributeName ] ||
209+ model . associations [ childAttributeName . charAt ( 0 ) . toUpperCase ( ) + childAttributeName . slice ( 1 ) ]
210+ }
211+
207212 /**
208213 * Create a model, and associate it with its parent model.
209214 *
@@ -219,7 +224,7 @@ module.exports = class FootprintService extends Service {
219224 if ( ! parentModel ) {
220225 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } can't be found` ) )
221226 }
222- const association = parentModel . associations [ childAttributeName ]
227+ const association = this . _findNativeAssociation ( parentModel , childAttributeName )
223228 if ( ! association ) {
224229 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } 's association ${ childAttributeName } can't be found` ) )
225230 }
@@ -272,7 +277,7 @@ module.exports = class FootprintService extends Service {
272277 if ( ! parentModel ) {
273278 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } can't be found` ) )
274279 }
275- const association = parentModel . associations [ childAttributeName ]
280+ const association = this . _findNativeAssociation ( parentModel , childAttributeName )
276281 if ( ! association ) {
277282 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } 's association ${ childAttributeName } can't be found` ) )
278283 }
@@ -340,7 +345,7 @@ module.exports = class FootprintService extends Service {
340345 if ( ! parentModel ) {
341346 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } can't be found` ) )
342347 }
343- const association = parentModel . associations [ childAttributeName ]
348+ const association = this . _findNativeAssociation ( parentModel , childAttributeName )
344349 if ( ! association ) {
345350 return Promise . reject ( new ModelError ( 'E_NOT_FOUND' , `${ parentModelName } 's association ${ childAttributeName } can't be found` ) )
346351 }
0 commit comments