I have started creating a Rails app to track games and scores and present results in a league format.
The games I have are Pool, Table Football, Table Tennis and FIFA for PS4. I have set up player accounts using Devise and decided what models I think I'm going to need, but I have run into problems when trying to get it all to work.
Here's where I am at the moment:
The models I anticipate needing for now are:
- Player (set up using Devise)
- Game (A game result)
- GameType (FIFA, table tennis etc)
- Score (individual scores for each game result and player)
The way I see the relationships working are like this:
I have successfully 'created' a game but my main sticking point is how to create the Scores at the same time so that they belong to the Game, get associated to the correct players, and can be read out again if I were to edit the game. Should I do the Score creation and association in the Game controller, or on the Game model?
My instincts tell me that the model is the correct way of creating Scores on Game creation using virtual parameters, but this is proving extremely tricky for me and I'd just some advice on how other people would set this up?