{"action":"closed","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/1099","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/1099/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/1099/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/1099/events","html_url":"https://github.com/strongloop/loopback/issues/1099","id":57989616,"number":1099,"title":"Polymorphic relation messes up delete for $owner of model","user":{"login":"zanemcca","id":3848969,"avatar_url":"https://avatars.githubusercontent.com/u/3848969?v=3","gravatar_id":"","url":"https://api.github.com/users/zanemcca","html_url":"https://github.com/zanemcca","followers_url":"https://api.github.com/users/zanemcca/followers","following_url":"https://api.github.com/users/zanemcca/following{/other_user}","gists_url":"https://api.github.com/users/zanemcca/gists{/gist_id}","starred_url":"https://api.github.com/users/zanemcca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanemcca/subscriptions","organizations_url":"https://api.github.com/users/zanemcca/orgs","repos_url":"https://api.github.com/users/zanemcca/repos","events_url":"https://api.github.com/users/zanemcca/events{/privacy}","received_events_url":"https://api.github.com/users/zanemcca/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-17T22:04:09Z","updated_at":"2015-02-18T17:33:19Z","closed_at":"2015-02-18T17:33:19Z","body":"Getting the following error\r\n ```events.js:72\r\n            throw er; // Unhandled 'error' event\r\n    TypeError: Cannot read property 'prototype' of null\r\n        at isUserClass /node_modules/loopback/common/models/role.js\r\n```\r\nWhen I looked at it it appears to be getting called with a null modelTo from within modelClass.findById in role.js. I have a polymorphic belongTo relation that I think is causing the problem. I modified isUserClass to return false if the passed in modelClass is null and it cleared the issue up for me."}}