I’m new to programming but wanted to try my hand at implementing a
‘Team’ model for my site and wanted to see how others would approach
it.
Right now I am creating a ‘Team’ model that would be owned by a Team
Captain (i.e. a person) and would be comprised of a Team Captain and
other people.
‘Team’ has it’s own model and controller and a simple collection of
specs (i.e. name, description, points).
Where I start to get confused is how I should implement the ‘roster’.
At this point, my thinking is to create a ‘team_connection’ model that
associates the team with a person_id.
Is this a sound approach or should I create some ‘roster’ model that
the Team owns and allow Team Captains to admin the roster contents?
Where I start to get confused is how I should implement the ‘roster’.
At this point, my thinking is to create a ‘team_connection’ model that
associates the team with a person_id.
Is this a sound approach or should I create some ‘roster’ model that
the Team owns and allow Team Captains to admin the roster contents?
I hope this is clear. How would you do it?
A few questions…
Do people belong to more than one team?
If no, then you can just do something like:
Team has_many players
Player belongs_to Team
For the team captain, you could add an attribute on Player (person)
that’s a boolean for is_captain? or something. Another option would be
to add a foreign_key on Team for captain_id and that’d link to a
Player.
Good luck,
Robby
Robby R.
Founder and Executive Director
PLANET ARGON, LLC
Design, Development, and Hosting with Ruby on Rails