Super Classes and Database Tables


#1

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


#2

maybe this helps to clear things up:
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, …