List Info

Thread: Is this a case for STI?




Is this a case for STI?
user name
2006-01-30 21:03:04
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
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Is this a case for STI?
user name
2006-01-30 21:13:01
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.&nbsp; 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.&nbsp; 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.&nbsp; 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

On 1/30/06, Sean Hussey < seanhusseygmail.com">seanhusseygmail.com> wrote:
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. &nbsp;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? &nbsp;They'll all have similar
search result listings, different info detail listings, the same
";check password&quot; and "change password&quot; 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? &nbsp;What to do?

Thanks,

Sean
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org">Railslists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails



--
Ben Reubenstein
http://www.benr75.com
Is this a case for STI?
user name
2006-01-31 14:38:21
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

On 1/30/06, Ben Reubenstien <benrx-cr.com> wrote:
> 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
>
>
> On 1/30/06, Sean Hussey <seanhusseygmail.com> wrote:
> >
> > 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
> > _______________________________________________
> > Rails mailing list
> > Railslists.rubyonrails.org
> > h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
> >
>
>
>
> --
> Ben Reubenstein
> http://www.benr75.com
> _______________________________________________
> Rails mailing list
> Railslists.rubyonrails.org
> h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Apache2 + Virtual Host + Awstats
user name
2006-01-31 15:30:55
Hi,

i try to make stats with Awstats and Apache2 :

Virtual configuration :

<VirtualHost *:80>
    ServerName www
    ServerAlias 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
 </Directory>
</VirtualHost>



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

I don't understand

-- 
Pierre Fauquembergue et cordialité,
KEY PGP : 0X53F7F5C4C
PHONE : +33 873 183 339
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Apache2 + Virtual Host + Awstats
user name
2006-01-31 17:19:43
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

On 1/31/06, Pierre Fauquembergue
<pierre.fauquemberguegmail.com> wrote:
> Hi,
>
> i try to make stats with Awstats and Apache2 :
>
> Virtual configuration :
>
> <VirtualHost *:80>
>     ServerName www
>     ServerAlias 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
>  </Directory>
> </VirtualHost>
>
>
>
> 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
> 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.
>
> I don't understand
>
> --
> Pierre Fauquembergue et cordialité,
> KEY PGP : 0X53F7F5C4C
> PHONE : +33 873 183 339
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
>
iQCVAwUAQ9+Cr0hiD6dT91xMAQKUWAP/SNLMjBs5NsUSMgKBqzvRS9Sk2aDH
moee
>
4aoDmaDxSzgf1NVEd48T6IcYDWrjRhFFjoR1EePlwMxBv4HQzyukX+40ws7M
BCm2
>
NpvrVbJ/tu4wB7NXldntUsM2pDkWUpox2Ckww/dca0McV9ij59UpyJHuaZfP
2Lbv
> qIk6n/7K3Po=
> =8b2O
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Rails mailing list
> Railslists.rubyonrails.org
> h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )