Hi I keep running into a problem on trying to figure how I can create lists in Rails. My problem is I have a Team object, then I have a fixture object which contains a hometeam and awayteam, I want to be able generate the fixtures automatically, e.g. I have 20 teams so each team has 38 games they need to play each team home and away, how can I create a fixtures list to meet these requirements or is it possible in Rails. By making each team play everyone at home once it will create all the away fixtures also.
Share
Ruby Array has a method
combinationthat does the job. http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-combinationSomething like
Will create all 380 fixtures for 20 teams.