# What's the pattern for "has many of yourself"?

**URL:** <https://www.ruby-forum.com/t/whats-the-pattern-for-has-many-of-yourself/90933>\
**Category:** Rails\
**Created:** [April 3, 2007, 3:33am UTC](https://www.ruby-forum.com/t/whats-the-pattern-for-has-many-of-yourself/90933 "2007-04-03T03:33:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b4bc9f/32.png) [@Duane](https://www.ruby-forum.com/u/Duane)\
**Post date:** [April 3, 2007, 3:33am UTC](https://www.ruby-forum.com/t/whats-the-pattern-for-has-many-of-yourself/90933/1 "2007-04-03T03:33:41Z")

</div>

I feel like I should kow this, but it’s ust not coming to me. I have a  
model that points to a bunch of “related” instances of itself. That is,  
Foo has\_many :foos.

How am I supposed to model that relationship? If I do a “has and  
belongs to many” then I’m going to end up with a majors\_majors table?

---

<div class="post-metadata">

**Author:** ![Duane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b4bc9f/32.png) [@Duane](https://www.ruby-forum.com/u/Duane)\
**Post date:** [April 3, 2007, 4:05am UTC](https://www.ruby-forum.com/t/whats-the-pattern-for-has-many-of-yourself/90933/2 "2007-04-03T04:05:10Z")

</div>

has\_many :foos  
belongs\_to :foo

should work with a foo\_id column in the table.

Michael
