{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/data/issues/2957","labels_url":"https://api.github.com/repos/emberjs/data/issues/2957/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/data/issues/2957/comments","events_url":"https://api.github.com/repos/emberjs/data/issues/2957/events","html_url":"https://github.com/emberjs/data/issues/2957","id":65109161,"number":2957,"title":"inverseRecord.get('isEmpty') is being called on objects that aren't arrays","user":{"login":"tonytamps","id":2356776,"avatar_url":"https://avatars.githubusercontent.com/u/2356776?v=3","gravatar_id":"","url":"https://api.github.com/users/tonytamps","html_url":"https://github.com/tonytamps","followers_url":"https://api.github.com/users/tonytamps/followers","following_url":"https://api.github.com/users/tonytamps/following{/other_user}","gists_url":"https://api.github.com/users/tonytamps/gists{/gist_id}","starred_url":"https://api.github.com/users/tonytamps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonytamps/subscriptions","organizations_url":"https://api.github.com/users/tonytamps/orgs","repos_url":"https://api.github.com/users/tonytamps/repos","events_url":"https://api.github.com/users/tonytamps/events{/privacy}","received_events_url":"https://api.github.com/users/tonytamps/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T00:02:35Z","updated_at":"2015-03-30T21:32:36Z","closed_at":"2015-03-30T21:30:14Z","body":"So I had a bit of an issue where this assertion was being raised because my model has an `isEmpty` property on it. \r\n\r\n```\r\n} else {\r\n  Ember.assert(\"You looked up the '\" + this.key + \"' relationship on ... )\", this.inverseRecord === null || !this.inverseRecord.get('isEmpty'));\r\n  return this.inverseRecord;\r\n}\r\n```\r\n\r\nI had a discussion with some other team members and we realised that the code here would handle both models and arrays, which would mean that `isEmpty` is intended to be called on the arrays. Correct?\r\n\r\nWould it be possible to check if `this.inverseRecord` is an array before getting `isEmpty`?\r\n\r\nhttps://github.com/emberjs/data/blob/87dec3e56b6b1744c49103417cc8cacc8f1edb23/packages/ember-data/lib/system/relationships/state/belongs-to.js#L139\r\n\r\nI have seen similar issues like #2328 but I'm not positive removing the internal properties off the models will resolve this issue I can't see any mention of removing the properties from arrays, which would still cause issues here."},"comment":{"url":"https://api.github.com/repos/emberjs/data/issues/comments/87837463","html_url":"https://github.com/emberjs/data/issues/2957#issuecomment-87837463","issue_url":"https://api.github.com/repos/emberjs/data/issues/2957","id":87837463,"user":{"login":"tonytamps","id":2356776,"avatar_url":"https://avatars.githubusercontent.com/u/2356776?v=3","gravatar_id":"","url":"https://api.github.com/users/tonytamps","html_url":"https://github.com/tonytamps","followers_url":"https://api.github.com/users/tonytamps/followers","following_url":"https://api.github.com/users/tonytamps/following{/other_user}","gists_url":"https://api.github.com/users/tonytamps/gists{/gist_id}","starred_url":"https://api.github.com/users/tonytamps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonytamps/subscriptions","organizations_url":"https://api.github.com/users/tonytamps/orgs","repos_url":"https://api.github.com/users/tonytamps/repos","events_url":"https://api.github.com/users/tonytamps/events{/privacy}","received_events_url":"https://api.github.com/users/tonytamps/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T21:32:36Z","updated_at":"2015-03-30T21:32:36Z","body":"Yeah that was our solution for now. I guess in that case it should no longer be an issue once the ember internal properties are moved (like in the linked issue).\r\n\r\nThanks."}}