# How do you associate "Notes" to many models?

**URL:** <https://www.ruby-forum.com/t/how-do-you-associate-notes-to-many-models/151028>\
**Category:** Rails\
**Created:** [October 16, 2008, 2:30am UTC](https://www.ruby-forum.com/t/how-do-you-associate-notes-to-many-models/151028 "2008-10-16T02:30:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [October 16, 2008, 2:30am UTC](https://www.ruby-forum.com/t/how-do-you-associate-notes-to-many-models/151028/1 "2008-10-16T02:30:03Z")

</div>

I’m trying to find the best way to associate notes to many models. I  
have a table called notes, and the tables I wanted associated to those  
notes are:

players  
teams  
parents

To accomplish it, would my notes database column just have the  
following:

## Note

body:string  
player\_id:integer  
team\_id:integer  
parent\_id:integer

That does seem messy, so I don’t know if that’s correct. Is there a  
better approach to associate notes to many models?

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [October 16, 2008, 3:04am UTC](https://www.ruby-forum.com/t/how-do-you-associate-notes-to-many-models/151028/2 "2008-10-16T03:04:20Z")

</div>

On Oct 16, 8:30 am, Bob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Posted viahttp://www.ruby-forum.com/.  
> Does a note need to be associated with only one of the 3 tables for  
> each instance? If yes, take a look at has\_many\_polymorphs.

[http://m.onkey.org/2007/8/14/excuse-me-wtf-is-polymorphs](http://m.onkey.org/2007/8/14/excuse-me-wtf-is-polymorphs)  
[http://blog.evanweaver.com/files/doc/fauna/has\_many\_polymorphs/files/README.html](http://blog.evanweaver.com/files/doc/fauna/has_many_polymorphs/files/README.html)
