I have a user and a skill table joined in a SkillUser table. (has many
Now I try to get all Skills listed which are not already in the join
for user 1
In other words: user 1 has entries in the SkillUser table for skill 1
2. And I want to get skill 3…to …in the result, but not 1 or 2.
I have tried:
skills = Skill.sort.includes(:skill_users).where(‘skill_users.user_id
IN (?)’, @user.id)
But then I only get all the skills listed for all other users already
listed in the SkillUser table.
Somehow I thing about a filter like
skill = Skill.sort
skill.filter(substract skills for user x which are already in SkillUser)
Any idea? Thanks for help…