emberfire icon indicating copy to clipboard operation
emberfire copied to clipboard

subcollections implemented in a way that prevents multiple hasmany relationships with the same model

Open knownasilya opened this issue 4 years ago • 0 comments

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.

knownasilya avatar Jun 27 '20 03:06 knownasilya