I have this function: I'm trying to compare to lists of records to see if there is a match between the two of them.
def current_user_has_team?(user, teams) do
user = user |> Repo.preload(:teams)
Enum.member?(user.teams, teams)
end
This is not working though because it's returning false when there is only one record and they are matching.
How can I say: "Look at this list of records, do any of these match within this other list?" in Elixir?
It would be this in Ruby:
list_1 = [1,2,3]
list_2 = [3,4,5]
(list_1 & list_2).any? => true