Hi guys, I have been facing an issue while working with many to many relationship models. For example, I have 2 models: Team and Project, a Team can have many Projects and also a Project can be in many Teams, but each Team will have a Permission with a particular Project, such as Team A can only READ the Project 1 but Team B can WRITE the Project 1. So I need a join model to between Team and Project to specify the Permission, I will call it Team_Project model. To let it be clear, I have a diagram like this:
So here is how I design the models in Ember:
//models/team.js
export default Model.extend({
teamProjects: hasMany('team-project')
name: attr('string'),
})
//models/project.js
export default Model.extend({
teamProjects: hasMany('team-project')
name: attr('string'),
})
//models/team-project.js
export default Model.extend({
team: belongsTo('team'),
project: belongsTo('project'),
permission: attr('string'),
})
Let say I loaded all of them into the store, when I tried to project.destroyRecord() => it just marked that project.isDeleted = true, it did not unload automatically from the store. The same as teamProject.destroyRecord() and team.destroyRecord() => it just marked that isDeleted = true, it did not unload automatically from the store.
Is there something that I missed ?