Best way to setup this relationship in activerecord

Hi Nathan,

I'm only just starting out with Rails too, but here are my thoughts...

Using inheritance in ordinary object-oriented languages gives you a few benefits (and a few drawbacks!). Primarily, these are reuse and polymorphism.

If you are going to want to define a number of similar methods on doctor and patient (including performing much of the same validation), it may be worthwhile using inheritance. This way, you can write less unit tests, and reduce duplication of code.

Furthermore, if you are likely to want to access all of the users in the system, you can just iterate over Users rather than Doctors and Patients.

If you are interested in using inheritance, there are a number of ways in which you can represent this relationship in your database. I would recommend reading the relevant section in Agile Web Development with Rails, if you have a copy of this book. And if you don't, I can't recommend it highly enough; it's fantastic.

Hope this helps!

Cheers, Louis.