Forum: Ruby on Rails Refactoring Existing Application For Login Accounts

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.
Justin W. (Guest)
on 2007-06-19 19:39
(Received via mailing list)
A client has asked me to modify their existing application to allow
for clients and tutors to be able to login, modify their personal
information, input time and other actions.  The application has a
single table called contacts and uses single table inheritance to
define three models Contact, Client (descendent of Contact) and Tutor
(descendent of Contact).   There is also a User model and subsequent
table that contains the actual user accounts of the employees of the
client's company.

The client now wants Tutors and Clients to have their own unique
logins to allow them to perform various actions depending on what type
of user they are.  For example, a tutor can login and enter their
weekly hours while a Client can login and see their bill and pay it.

My question is how should I refactor this to allow for clients, tutors
and users to login, but each be shown a different set of options &
interface.  My initial thought pattern was to move Clients & Tutors to
the Users table and inherit from it, but I think I need to seek second
opinion before moving forward.

Any suggestions?

-
Justin W.
Second Gear
http://www.secondgearllc.com/
Justin W. (Guest)
on 2007-06-21 08:05
(Received via mailing list)
Anyone?

- j
bryanl (Guest)
on 2007-06-21 17:00
(Received via mailing list)
On Jun 19, 11:38 am, Justin W. <removed_email_address@domain.invalid> wrote:
> My question is how should I refactor this to allow for clients, tutors
> and users to login, but each be shown a different set of options &
> interface.  My initial thought pattern was to move Clients & Tutors to
> the Users table and inherit from it, but I think I need to seek second
> opinion before moving forward.

You could store the type of user in the user table using
polymorphism.  That way, you can detect what type of user they are and
send them to the correct location.
This topic is locked and can not be replied to.