# I need help with self referential habtm

**URL:** <https://www.ruby-forum.com/t/i-need-help-with-self-referential-habtm/156763>\
**Category:** Rails\
**Created:** [January 2, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/i-need-help-with-self-referential-habtm/156763 "2009-01-02T17:20:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pipex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pipex](https://www.ruby-forum.com/u/pipex)\
**Post date:** [January 2, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/i-need-help-with-self-referential-habtm/156763/1 "2009-01-02T17:20:54Z")

</div>

Hello!

I need some help with self referential habtm associations:

I have a table inscripted and an inscripted may have a dependant, that  
works  
ok with this  
has\_and\_belongs\_to\_many :all\_friends,  
:class\_name =\> “Inscrito”,  
:join\_table =\> “related\_inscritos”,  
:foreign\_key =\> “related\_inscrito\_id”,  
:association\_foreign\_key =\> “main\_inscrito\_id”

i have related\_inscritos table to save the association.  
But now I need to add a type of relation for each association, does  
anyone  
know how to do this??

Please any help will be very useful!!

## Thanks

Felipe V. Contesse  
IngenierÃ­a Civil Industrial UC
