Topic: Different user types

Hi,

I have a website where users should be able to register either as Patients or as Clinics.
(there will also exist site admins)

My first reaction was to have a users table for all types. Patients and Clinics will have different fields but essentially they are all users so in the users table i would have:
username
password
patient_address
clinic_address
etc

However, this approach doesn't sound too good especially since there will be lots of fields.

Another viable option would be to use Polymorphic Associations.

I'd like to hear your suggestions.
Thanks.


P.S. I will be using Devise.

Re: Different user types

mabe having something like this

User
category_id

Category
type (clinic, patient, etc)

or if you need more data depending if it's patient or clinic, having a polymorphic association should work fine

Re: Different user types

I say you have one user model.

Then you have a patient model and a clinic model.  finally, you have something like a 'patientships' model that attaches patients to clinics.

patient belongs to clinic thru 'patientships' (or something along those lines.)..

or, you could use polymorphic assoc. but I don't know if that would be as clean...?