# Super Classes and Database Tables

**URL:** <https://www.ruby-forum.com/t/super-classes-and-database-tables/157120>\
**Category:** Rails\
**Created:** [January 7, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/super-classes-and-database-tables/157120 "2009-01-07T16:11:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/87869e/32.png) [@daz](https://www.ruby-forum.com/u/daz)\
**Post date:** [January 7, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/super-classes-and-database-tables/157120/1 "2009-01-07T16:11:14Z")

</div>

Hi, I have a database question.

I’m trying to plan a simple app for tracking pupil progress at a  
school. These are the models and associations I had in mind:

Teachers :have\_many Classes  
Classes :have\_many Pupils  
Classes :belong\_to Subjects  
Subjects: have\_many Topics

I thought that it would be a good idea to have a super class of Person  
that Teachers and Pupils could inherit from. How does this work with  
the database tables? Do I have a people table or separate teachers and  
pupils tables? Teachers will have some attributes that Pupils won’t  
(payroll number for example). Would these be included in the super  
class people table and just set as nil for pupils or is there a better  
way of doing this?

Also, I know that I can’t use Class for a model name - should I use  
Klass, Clas or change the name to something like Group?

cheers,

DAZ

---

<div class="post-metadata">

**Author:** ![daz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/87869e/32.png) [@daz](https://www.ruby-forum.com/u/daz)\
**Post date:** [January 7, 2009, 4:35pm UTC](https://www.ruby-forum.com/t/super-classes-and-database-tables/157120/2 "2009-01-07T16:35:22Z")

</div>

maybe this helps to clear things up:  
[http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations](http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations)

as for your question regarding class/klass/clas/…: that’s up to  
you.  
you could as well use SchoolClass, Form, …
