Topic: Need help/advice on Model/Schema design + associations
Hello everyone. I hope this is the right place to be asking this. And I apologize for the really long post, but I hope somebody has some time to read through it. I need some help and guidance in designing my db tables and their associations for a Ruby on Rails project.
Summary: To create a Sports League Management site with basic Organization, League, Seasons, Divisions, Teams & Player models.
I will write out some of the top level associations in plain english and hopefully somebody can help translate them into RoR associations.
The site will support multiple Organizations.
Organization has many Leagues
Organization has many Users (all the Users are created in the system, but each Organization has its own User base)
League has many Divisions
League has many Teams
Team has many Players (as User)
Team has many Sponsors
Team has one Captain (as User, also a Player)
Division has many Seasons
Season has many Games
So I can pretty much figure out how to create the above models. It starts to get a bit tricky after that and this is where I need some help.
I would like to create a Schedule of games for each Division, per Season. The schedule is simple enough to put together in a spreadsheet and update manually, but I would like to be able to do this within the site programmatically. This is how my spreadsheet looks right now:
In my mind, I see the schedule as a bunch of