join group and quit group by has_many through