Because you're calling `uniq` this no longer returns a relation and therefore it can't be used as a scope. Use distinct to return a unique set (if possible).