{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/4421","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/4421/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4421/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/4421/events","html_url":"https://github.com/sequelize/sequelize/issues/4421","id":104497207,"number":4421,"title":"Issue with model.addAssociation (example included)","user":{"login":"briangonzalez","id":659829,"avatar_url":"https://avatars.githubusercontent.com/u/659829?v=3","gravatar_id":"","url":"https://api.github.com/users/briangonzalez","html_url":"https://github.com/briangonzalez","followers_url":"https://api.github.com/users/briangonzalez/followers","following_url":"https://api.github.com/users/briangonzalez/following{/other_user}","gists_url":"https://api.github.com/users/briangonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/briangonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briangonzalez/subscriptions","organizations_url":"https://api.github.com/users/briangonzalez/orgs","repos_url":"https://api.github.com/users/briangonzalez/repos","events_url":"https://api.github.com/users/briangonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/briangonzalez/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-02T14:46:40Z","updated_at":"2015-09-04T15:05:16Z","closed_at":"2015-09-04T15:05:16Z","body":"Hey there,\r\n\r\nI am running into an issue where I have a `belongsTo` and a `hasMany` relationship defined, a claimant and a coupon.  Given two models, a `claimant` and a `coupon`, if I try to call `claimant.addCoupon`, an error is thrown saying `undefined is not a function`\r\n\r\n#### [REPO WITH WORKING CODE](https://github.com/briangonzalez/sequelize-example)\r\n\r\n```js\r\n// Grab the coupon.\r\nmodels.coupon.find({\r\n  where: {\r\n    claimant_id: null,\r\n  }\r\n})\r\n\r\n.then(function (coupon) {\r\n\r\n  // Find or create the claimant, then add the coupon.\r\n  return models.claimant.findOrCreate({\r\n    where: {\r\n      email: 'me@briangonzalez.org'\r\n    }\r\n  })\r\n\r\n  .then(function (claimant) {\r\n    // Why doesn't this work?\r\n    claimant.addCoupon(coupon);\r\n  });\r\n\r\n});\r\n```\r\n\r\nThe code above lives in [index.js here](https://github.com/briangonzalez/sequelize-example/blob/master/index.js#L11-L28).\r\nYou can see my [model definitions here](https://github.com/briangonzalez/sequelize-example/tree/master/models).\r\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/137761017","html_url":"https://github.com/sequelize/sequelize/issues/4421#issuecomment-137761017","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4421","id":137761017,"user":{"login":"briangonzalez","id":659829,"avatar_url":"https://avatars.githubusercontent.com/u/659829?v=3","gravatar_id":"","url":"https://api.github.com/users/briangonzalez","html_url":"https://github.com/briangonzalez","followers_url":"https://api.github.com/users/briangonzalez/followers","following_url":"https://api.github.com/users/briangonzalez/following{/other_user}","gists_url":"https://api.github.com/users/briangonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/briangonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briangonzalez/subscriptions","organizations_url":"https://api.github.com/users/briangonzalez/orgs","repos_url":"https://api.github.com/users/briangonzalez/repos","events_url":"https://api.github.com/users/briangonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/briangonzalez/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T15:05:16Z","updated_at":"2015-09-04T15:05:16Z","body":"Ahh, I was unfamiliar with `spread`. Thanks Mick and Jan!"}}