Forum: Ruby on Rails Recursive Tables + a single table inheritance Q

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b2a4ea7a2c486b1b0ceab3c6d4680d9?d=identicon&s=25 Joe Cairns (diregnome)
on 2006-04-18 18:00
Hi, what is the RoR way of handling a recursive table?  I'm a little
confused how to set this up in the model.

My example is the employee table.  Employees holds a list of employees,
and a recursive link to itself to show org structure.

Employees
--------
id (pk)
name
type -- this is for single table inheritance... ie supervisor, manager,
minion
employee_id -- (fk's to employees.id) this is the id of the employee's
boss


Also, I'm setting this up using single table inheritance.  If I wanted a
different view for each "type" would I set up a completely different
View? Could I use a different layout for each?
This topic is locked and can not be replied to.