{"action":"opened","issue":{"url":"https://api.github.com/repos/lanetix/node-bookshelf-soft-delete/issues/36","repository_url":"https://api.github.com/repos/lanetix/node-bookshelf-soft-delete","labels_url":"https://api.github.com/repos/lanetix/node-bookshelf-soft-delete/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/lanetix/node-bookshelf-soft-delete/issues/36/comments","events_url":"https://api.github.com/repos/lanetix/node-bookshelf-soft-delete/issues/36/events","html_url":"https://github.com/lanetix/node-bookshelf-soft-delete/issues/36","id":202734297,"number":36,"title":"Ambiguous deleted_at in deletion check when querying relations","user":{"login":"jadengore","id":1921464,"avatar_url":"https://avatars.githubusercontent.com/u/1921464?v=3","gravatar_id":"","url":"https://api.github.com/users/jadengore","html_url":"https://github.com/jadengore","followers_url":"https://api.github.com/users/jadengore/followers","following_url":"https://api.github.com/users/jadengore/following{/other_user}","gists_url":"https://api.github.com/users/jadengore/gists{/gist_id}","starred_url":"https://api.github.com/users/jadengore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jadengore/subscriptions","organizations_url":"https://api.github.com/users/jadengore/orgs","repos_url":"https://api.github.com/users/jadengore/repos","events_url":"https://api.github.com/users/jadengore/events{/privacy}","received_events_url":"https://api.github.com/users/jadengore/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-24T06:18:59Z","updated_at":"2017-01-24T06:18:59Z","closed_at":null,"body":"When I query a relation on a model, `deleted_at` is ambiguous because of the pivot table. This is caused because a relation does not have a `_knex` object. Instead, it contains info about the target table in its `relatedData` object.\r\n\r\nThe example below will break with `bookshelf-soft-delete` if `soft` is `true`:\r\n```js\r\nBook.related(\"chapter\").fetch().then((chapters) => {\r\n    // should return chapters that were not soft deleted\r\n})\r\n```\r\n\r\nI've come up with a rough solution that can be found [here](https://github.com/VideoAmp/node-bookshelf-soft-delete/commit/b1d884373f0bf62ea4913856844f811285133197), but I haven't written tests for it yet and I would like to field some feedback on my current implementation."}}
{"actor":{"display_login":"jadengore"}}