javascript - Sequelize: BelongsToMany error: <table> (alias) is not associated to <table> -
i can't seem figure 1 out. i've set belongstomany associations "as" value , still, error:
error: "user" (savers) not associated "link"
i have 2 models:
var user = sequelize.define("user", {...}); var link = sequelize.define("link", {...});
and following associations:
link.belongsto(user, {as: 'original_saver'}); link.belongstomany(user, {through: save, as: 'saves'}); user.belongstomany(link, {through: save, as: 'savers'});
the query i'm trying working following:
models.link.findall({ include: [ {model: models.user, as: 'savers'}, {model: models.user, as: 'original_saver'} ] })
what doing wrong here?
Comments
Post a Comment