Forum: Ruby on Rails Super Classes and Database Tables

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C4cd024191ff30fb901592e63d9ef820?d=identicon&s=25 DAZ (Guest)
on 2009-01-07 16: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?

cheers,

DAZ
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-07 16:35
(Received via mailing list)
maybe this helps to clear things up:
http://wiki.rubyonrails.org/rails/pages/Understand...

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