Think about this simple application in RUby on Rails:

Student &lifier Teacher stretches Person. Person has 2 qualities, title &lifier age. Student has 1 extra property, grade. Teacher has 1 extra property, salary.

I wish to keep student &lifier teacher information in separate db tables. I wish to make the most of RoR's utility class ActiveRecord:Base to retrive data of these models. Because Person isn't likely to be instantiated, I'm able to combine it with Student &lifier Teacher the following:

class Student < ActiveRecord:Base
include Person

module Person


  1. Is the right way of implementation?
  2. How you can implement this without developing a databse table known as persons? I simply want to generate 2 tables, namely students and teachers, and both must have the three qualities pointed out above.

Person doesn't have to become a model - it's really a library/module (that you simply then mixin according to your example). You'd keep that in RAILS_ROOT/lib. Your Student and Teacher classes could be models (designed to use AR::Base), and also the person can you need to be a lot of common techniques utilized by both.

Alternatively, if your little one class is much more complicated - consider "Single table inheritance" - the description which is past the scope of the answer... however, you can google for this.