I have a model User which has a "role" attribute which can be filled with either "employee" or "manager". Now I want a relationship where a manager has_many employees and an employee belongs_to a manager.
Is it possible to do this within the same model? I can think of something like this:
has_many :employees, class_name: "User", :foreign_key => "employee_id"
belongs_to :manager, class_name: "User", :foreign_key => "manager_id"
Even if this would work, I have doubts it is the most elegant solution, because you would have 2 extra foreign keys.