{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/4618","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/4618/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4618/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/4618/events","html_url":"https://github.com/sequelize/sequelize/issues/4618","id":110264389,"number":4618,"title":"<Table> is not associated to <Table>","user":{"login":"Name-less","id":10023703,"avatar_url":"https://avatars.githubusercontent.com/u/10023703?v=3","gravatar_id":"","url":"https://api.github.com/users/Name-less","html_url":"https://github.com/Name-less","followers_url":"https://api.github.com/users/Name-less/followers","following_url":"https://api.github.com/users/Name-less/following{/other_user}","gists_url":"https://api.github.com/users/Name-less/gists{/gist_id}","starred_url":"https://api.github.com/users/Name-less/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Name-less/subscriptions","organizations_url":"https://api.github.com/users/Name-less/orgs","repos_url":"https://api.github.com/users/Name-less/repos","events_url":"https://api.github.com/users/Name-less/events{/privacy}","received_events_url":"https://api.github.com/users/Name-less/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-07T16:26:31Z","updated_at":"2015-10-07T16:36:55Z","closed_at":null,"body":"I have been through this issue for a while and I did not succeed to do what I want.\r\n\r\nI have two models, Teams and Assocs ( that are related through A2t table as implemented below : \r\n\r\n```\r\n   this.Assocs.belongsToMany(this.Teams, { as: 'AssocToTeam', through: this.A2t, foreignKey: 'a2t_assoId' });\r\n   this.Teams.belongsToMany(this.Assocs, { as: 'TeamToAsso', through: this.A2t, foreignKey: 'a2t_teamId' });\r\n```\r\n\r\nWhen I have an object Team and I want the Assoc, I can call : \r\n```\r\nmyTeam.getTeamToAsso() \r\n```\r\nand I get the assoc. Everything is normal.\r\n\r\nBut when I try to run the query : \r\n```\r\n   orm.Teams.sync()\r\n        .then(function(){\r\n            return orm.Teams.findAll({\r\n                include: [\r\n                    {\r\n                        model: orm.Assocs,\r\n                        through: {\r\n                            where: {asso_number: 1}\r\n                        }\r\n                    }\r\n                ]\r\n            })\r\n        })\r\n```\r\nIt says me that Teams and Assocs are not associated ... I think I miss one (or more) point(s) ...\r\n\r\n```\r\nUnhandled rejection Error: Assocs is not associated to Teams!\r\n```"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/146256051","html_url":"https://github.com/sequelize/sequelize/issues/4618#issuecomment-146256051","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4618","id":146256051,"user":{"login":"janmeier","id":1210224,"avatar_url":"https://avatars.githubusercontent.com/u/1210224?v=3","gravatar_id":"","url":"https://api.github.com/users/janmeier","html_url":"https://github.com/janmeier","followers_url":"https://api.github.com/users/janmeier/followers","following_url":"https://api.github.com/users/janmeier/following{/other_user}","gists_url":"https://api.github.com/users/janmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/janmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janmeier/subscriptions","organizations_url":"https://api.github.com/users/janmeier/orgs","repos_url":"https://api.github.com/users/janmeier/repos","events_url":"https://api.github.com/users/janmeier/events{/privacy}","received_events_url":"https://api.github.com/users/janmeier/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T16:36:55Z","updated_at":"2015-10-07T16:36:55Z","body":"You need to add the `as` part from the association to the include as well. Or you could save a reference to the association returned from belongsToMany and use `association:` instead "}}