Forum: Ruby on Rails Super Classes and Database Tables

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
DAZ (Guest)
on 2009-01-07 17:11
(Received via mailing list)
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?


MaD (Guest)
on 2009-01-07 17:35
(Received via mailing list)
maybe this helps to clear things up:

as for your question regarding class/klass/clas/...: that's up to
you could as well use SchoolClass, Form, ...
This topic is locked and can not be replied to.