I am assuming that you are calling interest_matches on tags within a group of tags,
Minor note: you are calling self.tags.uniq twice, in lines 1 and 3 of the function. Also,
unless matched_users.include?(u)
the above will iterate through the array every single time to check for existence of the user within the array, not the best option! Next time just call the .uniq method on it at the end.
Anyway, to answer your question, you probably want the join table to access the user's tags.
Method , may or may not work(hopefully it does):
@matched = []
group_of_tags = (i'm assuming this is predefined)
@matched << User.joins(:tags).where(tag_name: group_of_tags.pluck(:name))
@matched.uniq
Not 100% on this, but give it a go :)