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/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Justin Williams
2007-Jun-21 04:03 UTC
Re: Refactoring Existing Application For Login Accounts
Anyone? - j On Jun 19, 10:38 am, Justin Williams <carpea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 Gearhttp://www.secondgearllc.com/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 19, 11:38 am, Justin Williams <carpea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---