# Multiple parent ids

**URL:** <https://www.ruby-forum.com/t/multiple-parent-ids/97010>\
**Category:** Rails\
**Created:** [July 4, 2006, 8:00am UTC](https://www.ruby-forum.com/t/multiple-parent-ids/97010 "2006-07-04T08:00:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kublai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@kublai](https://www.ruby-forum.com/u/kublai)\
**Post date:** [July 4, 2006, 8:00am UTC](https://www.ruby-forum.com/t/multiple-parent-ids/97010/1 "2006-07-04T08:00:18Z")

</div>

Hi,

parent\_id is the default name for the self-reference foreign key. What  
is the convention for naming the second parent id, the third?

Thanks!  
gk

---

<div class="post-metadata">

**Author:** ![kublai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@kublai](https://www.ruby-forum.com/u/kublai)\
**Post date:** [July 4, 2006, 8:37am UTC](https://www.ruby-forum.com/t/multiple-parent-ids/97010/2 "2006-07-04T08:37:30Z")

</div>

On 7/4/06, Gene K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> parent\_id is the default name for the self-reference foreign key. What  
> is the convention for naming the second parent id, the third?
> 
> Thanks!  
> gk

Acts\_as\_tree uses a parent\_id, but there is no need for a second or  
third  
parent id since each object has only one parent. each parent can then  
have  
a parent for as many generations as you like, all using the parent\_id  
field. If something belongs to more than one parent directly, then you  
should use HABTM or has\_many :through

–
