Let's say i have an array called teams
.
I want to plan matches
for every team
with every other team
.
This is almost what i want except that same matches
are added twice:
teams.each do |red_team|
teams.each do |blue_team|
if red_team != blue_team
@planned_matches << Match.new(red_team, blue_team)
end
end
end
How to do that?