STI, controllers and views

Ryan Glover wrote:

First question. Do I need to create controller classes for each? I
don't think I do because a single controller should be able to shunt the
data between the models and the views.

No, you can use one controller if it makes sense in your application.

Second question. Say I have a view that shows a list of all people in
the db. It shows first name, last name, and a 'show' link to view that
persons details. For each type I would like to show a specific view,
i.e. the manager_view, the employee_view etc. If I have a single
controller with a show action and I pass it the person as a parameter
how do I get the controller to show the correct view?

Lots of ways. The first that comes to my mind would be ...

render :template => "people/#{@person.type.to_s.underscore}"

(assuming /app/views/people/manager.rhtml, etc.)
but I'm sure someone will come up with an option in even fewer lines of
code. :wink: