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 Williams Second Gear http://www.secondgearllc.com/
on 2007-06-19 17:39
on 2007-06-21 06:05
Anyone? - j
on 2007-06-21 15:00
On Jun 19, 11:38 am, Justin Williams <carpea...@gmail.com> 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.