dimanche 15 mars 2015

how to create relationship between User,Patient and Doctor table in ruby on rails?

I have three tables:




  • One for user that stores login information of user and its column are name, email, password,role and id. role is to tell whether he is a doctor or patient or an admin.




  • Next table is Patient table that only store id and other info of patient except name and emailid and password. To create a relationship the id of this table depends on id of User table to get name and email.




  • My last table is Doctor table that also store id and other info of doctor. Here also the id depends upon User table id column .




My question is how to create this relation in ruby on rails?


I am just a starter with ruby on rails and I am using sqlite db


Aucun commentaire:

Enregistrer un commentaire