- Put these statements in the Employee model:
has_many :subordinates, class_name: 'Employee',
foreign_key: 'manager_id'
belongs_to :manager, class_name: 'Employee'
- On the Employee index view, change the value
displayed in the Manager column from
<%= employee.manager_id %>
to
<%= employee.manager.name %>
- On the Employee show view at the bottom just above the Edit and Back links,
show the list of all the employees subordinates:
<h2>Subordinates of <%= @employee.name %></h2>
<p>
<% @employee.subordinates.each do |subord| %>
<%= subord.name %>
<% end %>
</p>