In my application, I have the following models:
User
Psychologist has_many classrooms
Teacher has_many classrooms
Parent has_many children
Director belongs_to school
Coordinator belongs_to school
My user model looks like the following:
class User < ActiveRecord
has_many :roles
def has_role? role_name
self.roles.where(role_type: role_name).any?
end
end
The Role model is polymorphic:
class Role < ApplicationRecord
belongs_to :user
belongs_to :roleable, polymorphic: true
end
And the other models are rollable.
My question is the following, it seems that this is not correct, because some models like: Director, Psychologists, Teachers, Coordinator and Parent. They only have relationships and their database tables do not have any other column except created_at, updated_at.
Is it okay to only create these models with relationships and have their tables without data?