Is this a case for STI?

Hi everyone,

We have different populations of people here at our college: Staff,
Faculty, Students, Alumni (and a host of “Other” that I’ll worry about
another day.

I originally had only Staff and Faculty loaded in under a Person model
using a Personnel controller. Now I want to add the students in, so I
thought STI might be the way to go:

class Person < AR::Base
class Staff < Person
class Faculty < Person
class Student < Person

My question is, where do I put everything? They’ll all have similar
search result listings, different info detail listings, the same
“check password” and “change password” functions.

I think it sounds nice to have one controller, but then the list and
search methods turn UGLY when trying to account for what the user is
actually looking for. My search methods are already ugly with all the
checking for whatever attribute the user is trying to search on.

Multiple controllers would break it out, but then there wouldn’t be
much that’s DRY about it.

Where to go? What to do?



Sean ~

I definitely thing this is a good use of STI. How you break out the
functionality will largely depend on how common elements are between the
different types of people. For instance you say that the search results
will look the same so lets say you have a controller called Person and
action called Search. This action could be shared by all Persons, and
the same view. When you go to the detail view however, you say you will
have different needs. You could create individual controllers, but
unless there is a lot of functionality, I would put it in the Person
Controller, staff_detail action, student_detail action, and so on. The
would look nice too:

/person/student_detail… and so on.

Anyhow just some thoughts to get you going.

~ Ben

That’s what I was thinking, but I feel like that’s more duplication.

Though, maybe I can set up one “detail” screen and, through the
action, set variables for what should be displayed. Hmm, that might




i try to make stats with Awstats and Apache2 :

Virtual configuration :

<VirtualHost *:80>
ServerName www
DocumentRoot /var/www/www/public/
ErrorLog /var/log/apache2/error_www.log
CustomLog /var/log/apache2/www-access.log combined
ServerPath /var/www/www/public/
<Directory /var/www/www/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from all

In /etc/awstats/

This :
do :
With data in log file “/var/log/apache2/www-access.log”…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Phase 2 : Now process new records (Flush history on disk after 20000
Jumped lines in file: 0
Parsed lines in file: 4
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 4 new qualified records.

I can’t access awstats at

I don’t understand

That is because needs to be located in
/var/www/www/public/cgi-bin/ or you need to setup a symbolic link.
David Genord II

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs