{"action":"created","issue":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/1465","labels_url":"https://api.github.com/repos/keystonejs/keystone/issues/1465/labels{/name}","comments_url":"https://api.github.com/repos/keystonejs/keystone/issues/1465/comments","events_url":"https://api.github.com/repos/keystonejs/keystone/issues/1465/events","html_url":"https://github.com/keystonejs/keystone/issues/1465","id":88651721,"number":1465,"title":"How to do polymorphism?","user":{"login":"arthurtalkgoal","id":7088330,"avatar_url":"https://avatars.githubusercontent.com/u/7088330?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurtalkgoal","html_url":"https://github.com/arthurtalkgoal","followers_url":"https://api.github.com/users/arthurtalkgoal/followers","following_url":"https://api.github.com/users/arthurtalkgoal/following{/other_user}","gists_url":"https://api.github.com/users/arthurtalkgoal/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurtalkgoal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurtalkgoal/subscriptions","organizations_url":"https://api.github.com/users/arthurtalkgoal/orgs","repos_url":"https://api.github.com/users/arthurtalkgoal/repos","events_url":"https://api.github.com/users/arthurtalkgoal/events{/privacy}","received_events_url":"https://api.github.com/users/arthurtalkgoal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/keystonejs/keystone/labels/question","name":"question","color":"604b7c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-06-16T08:06:53Z","updated_at":"2015-06-24T11:46:06Z","closed_at":null,"body":"Hi,\r\n\r\nI have a ```Tag``` model which can be attached to many target models.\r\n\r\ne.g.\r\n\r\n```\r\n\r\nDeal.add({\r\n...\r\ntaggable_type:  {...}\r\n taggable_id: {　...},\r\n  \r\n});\r\n\r\n```\r\nOr\r\n```\r\nDeal.add({\r\n...\r\ntaggable: { type: Types.Relationship, ref: 'Tag'},\r\n...\r\n});\r\n\r\n```\r\n\r\nThen  how to define the relationship in ```Tag``` model?\r\n```\r\nTag.relationship({ path: 'objects', ref: '???', refPath: 'taggable' });\r\n```\r\n\r\nThanks,\r\n  \r\n"},"comment":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/comments/114840414","html_url":"https://github.com/keystonejs/keystone/issues/1465#issuecomment-114840414","issue_url":"https://api.github.com/repos/keystonejs/keystone/issues/1465","id":114840414,"user":{"login":"creynders","id":436347,"avatar_url":"https://avatars.githubusercontent.com/u/436347?v=3","gravatar_id":"","url":"https://api.github.com/users/creynders","html_url":"https://github.com/creynders","followers_url":"https://api.github.com/users/creynders/followers","following_url":"https://api.github.com/users/creynders/following{/other_user}","gists_url":"https://api.github.com/users/creynders/gists{/gist_id}","starred_url":"https://api.github.com/users/creynders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creynders/subscriptions","organizations_url":"https://api.github.com/users/creynders/orgs","repos_url":"https://api.github.com/users/creynders/repos","events_url":"https://api.github.com/users/creynders/events{/privacy}","received_events_url":"https://api.github.com/users/creynders/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T11:46:06Z","updated_at":"2015-06-24T11:46:06Z","body":"Argh, my bad, `path` should have a unique name each time, i.e.:\r\n\r\n```js\r\nTag.relationship({ path: 'tagsInDeal', ref: 'Deal', refPath: 'tags' });\r\nTag.relationship({ path: 'tagsInCompany', ref: 'Company', refPath: 'tags' });\r\n```"}}