{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1219","repository_url":"https://api.github.com/repos/tgriesser/bookshelf","labels_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1219/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1219/comments","events_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1219/events","html_url":"https://github.com/tgriesser/bookshelf/issues/1219","id":152626389,"number":1219,"title":"Polymorphic Relationships - Docs Confusing","user":{"login":"StavroMueller","id":3442610,"avatar_url":"https://avatars.githubusercontent.com/u/3442610?v=3","gravatar_id":"","url":"https://api.github.com/users/StavroMueller","html_url":"https://github.com/StavroMueller","followers_url":"https://api.github.com/users/StavroMueller/followers","following_url":"https://api.github.com/users/StavroMueller/following{/other_user}","gists_url":"https://api.github.com/users/StavroMueller/gists{/gist_id}","starred_url":"https://api.github.com/users/StavroMueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StavroMueller/subscriptions","organizations_url":"https://api.github.com/users/StavroMueller/orgs","repos_url":"https://api.github.com/users/StavroMueller/repos","events_url":"https://api.github.com/users/StavroMueller/events{/privacy}","received_events_url":"https://api.github.com/users/StavroMueller/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tgriesser/bookshelf/labels/docs","name":"docs","color":"0b02e1"},{"url":"https://api.github.com/repos/tgriesser/bookshelf/labels/PR%20please","name":"PR please","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-02T19:33:37Z","updated_at":"2016-06-10T16:06:56Z","closed_at":null,"body":"Hello All,\r\n\r\nThis is somewhat related to #1159, though not a bug. I find the example for polymorphic relations (http://bookshelfjs.org/#polymorphic) to be very confusing - the example names of `Photos` and `'imageable'` don't fit in with the overall theme of books, and there isn't enough context with this photo theme to be necessarily easy to follow. I would be happy to re-write with a metaphor that better fits the book theme present everywhere else in the docs. Let me know what you think!"},"comment":{"url":"https://api.github.com/repos/tgriesser/bookshelf/issues/comments/225224942","html_url":"https://github.com/tgriesser/bookshelf/issues/1219#issuecomment-225224942","issue_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1219","id":225224942,"user":{"login":"AntJanus","id":733810,"avatar_url":"https://avatars.githubusercontent.com/u/733810?v=3","gravatar_id":"","url":"https://api.github.com/users/AntJanus","html_url":"https://github.com/AntJanus","followers_url":"https://api.github.com/users/AntJanus/followers","following_url":"https://api.github.com/users/AntJanus/following{/other_user}","gists_url":"https://api.github.com/users/AntJanus/gists{/gist_id}","starred_url":"https://api.github.com/users/AntJanus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AntJanus/subscriptions","organizations_url":"https://api.github.com/users/AntJanus/orgs","repos_url":"https://api.github.com/users/AntJanus/repos","events_url":"https://api.github.com/users/AntJanus/events{/privacy}","received_events_url":"https://api.github.com/users/AntJanus/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T16:06:56Z","updated_at":"2016-06-10T16:06:56Z","body":"I'm looking at the API and something doesn't make sense to me. For example, `this.morphOne` has a second argument and doesn't matter if you have a 3rd argument as far as I understand so:\r\n\r\n```js\r\nthis.morphOne('whatever', 'entity'); //links to entity_type and entity_id\r\nthis.morphOne('whatever', 'entity', ['custom_type', 'custom_id']); //links to custom_type and custom_id, so why even use the second argument?\r\nthis.morphOne('whatever', 'entity', ['custom_type', 'custom_id'], 'my own type'); //and you have to use it in order to get to the 4th argument\r\n```\r\n\r\nIs there a better way to do this? For instance, \"smart\" arguments like:\r\n\r\n```js \r\nthis.morphOne('whatever', 'entity'); //checks entity_type and entity_id \r\nthis.morphOne('whatever', ['custom_type', 'custom_id']); //checks custom_type and custom_id\r\nthis.morphOne('whatever', ['custom_type', 'custom_id'], 'my own type'); //uses 'my own type' as a morphValue and uses custom_type and custom_id\r\nthis.morphOne('whatever', 'entity', 'my own type'); //uses 'my own type' as morphValue and entity_type and entity_id as lookup columns\r\n```"}}
{"actor":{"display_login":"AntJanus"}}