I am in the process of building a league management app.
I currently have seasons, leagues and teams that are all working fine. I
can create a new season, add the leagues that are playing in it and the
teams that play within each of the leagues.
What I now want to do is create fixtures for the teams. I have generated
a fixtures model and associated it with teams (has_many :teams) and
teams with fixtures (has_many :fixtures).
What I would like to be able to do when a user sets up the fixtures he
can just press a submit button that will generate all of the fixtures
between the teams (each team plays the other twice). I have been able,
using .permutations (get_team_combinations =
Team.names.permutation(2).to_a) to generate an array of fixtures but I
am stumped as
to how it would be possible to have each of these entries in the array
saved as a fixture in the database.
Anybody got any ideas how this is possible or an alternative way of
generating the fixtures?
Thanks for help in advance!