# Polymorphic Associations

**URL:** <https://www.ruby-forum.com/t/polymorphic-associations/110280>\
**Category:** Rails\
**Created:** [July 24, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/polymorphic-associations/110280 "2007-07-24T21:55:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cautaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@cautaro](https://www.ruby-forum.com/u/cautaro)\
**Post date:** [July 24, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/polymorphic-associations/110280/1 "2007-07-24T21:55:32Z")

</div>

Hello,

I hope somebody can help me figure out how to solve the following  
problem.

These are the models that I am trying to associate one to the other.

Location  
Organization =\> league, club, etc.  
Event =\> competition, class, etc.

League and Club (and others) are subclasses of Organization  
Competition and Class (and others) are subclasses of Event  
An event and an organization have many locations and a location has many  
organizations and events.

I have tried using STI at first and then polymorphic associations. I  
didn’t get too far, because this example uses two layers of polymorphic  
associations. Can someone give me a starting point at least?

Thanks,

Andrei

---

<div class="post-metadata">

**Author:** ![cautaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@cautaro](https://www.ruby-forum.com/u/cautaro)\
**Post date:** [July 26, 2007, 12:46am UTC](https://www.ruby-forum.com/t/polymorphic-associations/110280/2 "2007-07-26T00:46:33Z")

</div>

I’m not sure what you’re asking exactly, but can you try to create a  
very basic polymorphic association? Then slowly add to it making it  
more complex?

This helps me often

On Jul 24, 3:55 pm, Andrei E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
