ensure side loaded models are distinct for has_many :through

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.

I 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.