{"action":"created","issue":{"url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/107","labels_url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/107/comments","events_url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/107/events","html_url":"https://github.com/RestPack/restpack_serializer/pull/107","id":48647490,"number":107,"title":"ensure side loaded models are distinct for has_many :through","user":{"login":"rhec","id":62127,"avatar_url":"https://avatars.githubusercontent.com/u/62127?v=3","gravatar_id":"","url":"https://api.github.com/users/rhec","html_url":"https://github.com/rhec","followers_url":"https://api.github.com/users/rhec/followers","following_url":"https://api.github.com/users/rhec/following{/other_user}","gists_url":"https://api.github.com/users/rhec/gists{/gist_id}","starred_url":"https://api.github.com/users/rhec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhec/subscriptions","organizations_url":"https://api.github.com/users/rhec/orgs","repos_url":"https://api.github.com/users/rhec/repos","events_url":"https://api.github.com/users/rhec/events{/privacy}","received_events_url":"https://api.github.com/users/rhec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-11-13T15:20:21Z","updated_at":"2015-01-28T08:38:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RestPack/restpack_serializer/pulls/107","html_url":"https://github.com/RestPack/restpack_serializer/pull/107","diff_url":"https://github.com/RestPack/restpack_serializer/pull/107.diff","patch_url":"https://github.com/RestPack/restpack_serializer/pull/107.patch"},"body":"Currently when you side load models from a many to many relationship you will get duplicates if two source models both are related to the same side loaded model. This fixes the problem by adding a distinct to the side loading query scope.\r\n\r\nI did run into one problem using this myself, which is that distinct does not work on postgres tables which contain a JSON type column. Still thinking about a workaround for that, but since restpack has no other dbms specific code, I figured it might be worthwhile to merge as is since it fixes the general case."},"comment":{"url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/comments/71798545","html_url":"https://github.com/RestPack/restpack_serializer/pull/107#issuecomment-71798545","issue_url":"https://api.github.com/repos/RestPack/restpack_serializer/issues/107","id":71798545,"user":{"login":"GavinJoyce","id":2526,"avatar_url":"https://avatars.githubusercontent.com/u/2526?v=3","gravatar_id":"","url":"https://api.github.com/users/GavinJoyce","html_url":"https://github.com/GavinJoyce","followers_url":"https://api.github.com/users/GavinJoyce/followers","following_url":"https://api.github.com/users/GavinJoyce/following{/other_user}","gists_url":"https://api.github.com/users/GavinJoyce/gists{/gist_id}","starred_url":"https://api.github.com/users/GavinJoyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GavinJoyce/subscriptions","organizations_url":"https://api.github.com/users/GavinJoyce/orgs","repos_url":"https://api.github.com/users/GavinJoyce/repos","events_url":"https://api.github.com/users/GavinJoyce/events{/privacy}","received_events_url":"https://api.github.com/users/GavinJoyce/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T08:38:28Z","updated_at":"2015-01-28T08:38:28Z","body":"Sorry, I've been busy with a new baby. I'll review and hopefully merge this weekend"}}