I have a table User and there are three tables that inherit from this table as:
class Manager < User
has_many :projects
end
class Qa < User
has_many :bugs
end
class Developer < User
has_many :bugs
has_and_belongs_to_many :projects
end
The project and bug tables are as:
class Bug < ApplicationRecord
belongs_to :developer
belongs_to :qa
belongs_to :project
end
class Project < ApplicationRecord
belongs_to :manager
has_many :bugs
has_and_belongs_to_many :developers
end
The User table exists in the database and I am using STI for Manager, QA and Developer but how do I define migrations corresponding to the associations of these three tables?
So, I ultimately ended up using STI. The database migrations are as under: