Sequel ships with a plugin called rcte_tree that handles this case. You just load the plugin, and it adds methods that use recursive CTE queries to get all supervisors or all subordinates.