Topic: Modelling decision - newbie help required
This is my first post and I'm a newbie to Rails and OOP in general - so please bear with me.
My problem is (as I see it) all about deciding which way to model/associate my db/tables, I have the following tables:
I have tried to visualise my associations using the following:
note1: this is just a notepad file I've used and not genuine code
note2: The left column is my understanding of the relationship - the right column is Rails speak.
From a players' perspective
A player has many games # has_many :games
A player has many battles # has_many :battles
From a games' perspective
A game has a single owner (player) # belongs_to :player
A game has many scenarios # has_many :scenarios
A game has many battles # has_many :battles
From a scenarios' perspective
A scenario belongs to a game # belongs_to :game
A scenario belongs to a battle # belongs_to :battle
From a battles' perspective
A battle has one game # belongs_to :game
A battle has many players/winner # has_many :players
A battle has one scenario # belongs_to :scenario
Can someone confirm:
1. That I have identified the associations correctly on both sides of the relationship
2. Am I missing something with these associations?
Any help and/or constructive comments are gratefully appreciated.