# Polymorphic abstraction of Models, design help needed

**URL:** <https://www.ruby-forum.com/t/polymorphic-abstraction-of-models-design-help-needed/191170>\
**Category:** Rails\
**Created:** [July 6, 2010, 11:10pm UTC](https://www.ruby-forum.com/t/polymorphic-abstraction-of-models-design-help-needed/191170 "2010-07-06T23:10:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayanb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3da27b/32.png) [@ayanb](https://www.ruby-forum.com/u/ayanb)\
**Post date:** [July 6, 2010, 11:10pm UTC](https://www.ruby-forum.com/t/polymorphic-abstraction-of-models-design-help-needed/191170/1 "2010-07-06T23:10:54Z")

</div>

We have Models like Supplier, Distributor, Vendor, Buyer in our  
schema. These entities have some common attributes ( like name,  
description, sales offices etc.) but mostly they have a divergent  
schema with different has\_many :through associations ( a vendor has  
many stock\_keeping\_units , others do not) because of which they needed  
to be collapsed to separate models.

We also have various types of Events in the system, for example, a  
partnership event, a distributorship event, a procurement event, etc.

How can I create a is\_a relationship and abstract these buyer, vendor,  
etc models to a Company Model and when creating an event , like say a  
partnership event, simply say Company 1 partnered with Company 2  
without worrying what the company type is, so that I can do something  
like this on my form partial for an Event Submission:

\<%= f.label "Company 1" %\> \<%= f.collection\_select :partnering\_company\_id\_1, Company.all ,:id, :name, { :default =\> true} %\>

I am willing to share more details of the schema in case its needed.  
Is this possible? I recently came across this blog post (http://  
[Multiple Table Inheritance With ActiveRecord - Max Chernyak](http://mediumexposure.com/multiple-table-inheritance-active-record/)) which  
goes ahead and describes some smart Mutiple Table Inheritance but I am  
not sure if this is applicable to the current problem statement.
