I'm working on the design of an application in which there will be users with two (not necessarily distinct) roles, teachers and students. So, I'm thinking I'd have one User class with associated roles.
To make the code (hopefully) more readable, I'd like to refer to instances of the User class by an alias where the role is required. For example if the user must have the role of student I'd like to do something like this:
class Section < ActiveRecord::Base
alias :user :student
alias :user :teacher
belongs_to :teacher
has_many :students
end
Is there a way to do something like this?