emberfire
emberfire copied to clipboard
subcollections implemented in a way that prevents multiple hasmany relationships with the same model
Currently a subcollection is queried by the model name and not the relationship name:
// models/idea.js
outline: hasMany('outline-item', { subcollection: true })
Would call findHasMany and look for the subcollection outlineItems
under the idea
collection. This is an issue, because what if I wanted to do:
// models/idea.js
primaryOutline: hasMany('outline-item', { subcollection: true }),
secondaryOutline: hasMany('outline-item', { subcollection: true }),
It would not work, because both would get the same items. So the subcollection should be based on the name of the relationship instead.