# Please suggest an approach for a 'Team' model

**URL:** <https://www.ruby-forum.com/t/please-suggest-an-approach-for-a-team-model/138617>\
**Category:** Rails\
**Created:** [May 25, 2008, 11:45pm UTC](https://www.ruby-forum.com/t/please-suggest-an-approach-for-a-team-model/138617 "2008-05-25T23:45:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fountain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@Fountain](https://www.ruby-forum.com/u/Fountain)\
**Post date:** [May 25, 2008, 11:45pm UTC](https://www.ruby-forum.com/t/please-suggest-an-approach-for-a-team-model/138617/1 "2008-05-25T23:45:00Z")

</div>

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?

I hope this is clear. How would you do it?

---

<div class="post-metadata">

**Author:** ![Fountain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@Fountain](https://www.ruby-forum.com/u/Fountain)\
**Post date:** [May 26, 2008, 12:31am UTC](https://www.ruby-forum.com/t/please-suggest-an-approach-for-a-team-model/138617/2 "2008-05-26T00:31:25Z")

</div>

On Sun, May 25, 2008 at 8:55 AM, Fountain [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?
> 
> 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

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
