Hi :) I have a very weird issue:
I have an appointment model that has-many
mentions (established by a polymorphic association):
// Appointment model
mentions: hasMany('mention', { inverse: 'mentionable'})
When I first load the app, after restarting the browser, I make a get in my template like: and this returns a mention model that doesn't belong to the appointment. It returns all the mentions: the correct ones, (the ones with mentionable: appointment
) and also incorrect ones (e.g. with mentionable: attachment
)
If I log this incorrect mention I can see that its mentionable is in fact another model (attachment
) and its inverseKey
is undefined, which I suspect is the root of the problem.
All appointments and mentions are loaded before making this get, so I would expect all the associations are set by the time I get the route where I use them.
Details to mention:
- This only happens after restarting the browser.
mentions
are returned by the server along with appointments.
Any suggestion on how to fix this? Thanks in advanced.
Aucun commentaire:
Enregistrer un commentaire