# Is this a case for STI?

**URL:** <https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055>\
**Category:** Rails\
**Created:** [January 30, 2006, 10:05pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055 "2006-01-30T22:05:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 30, 2006, 10:05pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055/1 "2006-01-30T22:05:21Z")

</div>

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  
end  
class Staff \< Person  
end  
class Faculty \< Person  
end  
class Student \< Person  
end

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?

Thanks,

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 30, 2006, 10:14pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055/2 "2006-01-30T22:14:26Z")

</div>

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  
an  
action called Search. This action could be shared by all Persons, and  
use  
the same view. When you go to the detail view however, you say you will  
have different needs. You could create individual controllers, but  
again  
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  
urls  
would look nice too:

/person/staff\_detail  
/person/student\_detail… and so on.

Anyhow just some thoughts to get you going.

~ Ben

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 31, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055/3 "2006-01-31T15:40:10Z")

</div>

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  
work.

Thanks!

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 31, 2006, 4:41pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055/4 "2006-01-31T16:41:12Z")

</div>

Hi,

i try to make stats with Awstats and Apache2 :

Virtual configuration :

\<VirtualHost \*:80\>  
ServerName www  
ServerAlias [www.zieute.com](http://www.zieute.com)  
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/awstats.www.zieute.com.conf  
LogFile=â?/var/log/apache2/www-access.logâ?

This :  
/usr/lib/cgi-bin/awstats.pl -config=[www.zieute.com](http://www.zieute.com)  
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  
hosts)…  
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 [www.zieute.com/cgi-bin/awstats.pl](http://www.zieute.com/cgi-bin/awstats.pl).

I don’t understand

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 31, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/is-this-a-case-for-sti/99055/5 "2006-01-31T18:22:27Z")

</div>

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