Single Table inheritance

Hi Everyone,

Just been thinking and working on some problem in Supply Chain and came
across a situation. This is like this using single table inheritance I
have a single table called company and the active record are like this:

class Company < ActiveRecord::Base

class Vendor < Company
class Customer < Company
class Office < Company

Then there is another class called Region which is

class Region < ActiveRecord::Base

now there is many to many relationship between Vendor and Region and
there is many to many relationship between Office < Region and also in

Now can I use vendor_id , customer_id and office_id as foreign key or
can only use company_id since the table for company is only 1 with
primary key id.

Thanks for help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs