红宝石导轨。我正在尝试将医生的预约与用户(医生和患者)联系起来。有一个用户模型,它具有患者和医生的角色。链接这个的最佳方法是什么?约会应该只有一名医生和一名用户分配到一个约会时段。谢谢你的帮助
attr_accessible :email, :password, :password_confirmation, :remember_me, :dob, :first_name, :last_name, :gender, :doctor, :pps_no, :specialisation_id, :roles, :roles_id, :roles_name, :appointments, :appointments_id
# attr_accessible :title, :body
has_many :appointments, :through => :users_appointments
has_many :users_appointments
has_and_belongs_to_many :specialisations
has_many :roles, :through => :roles_users
has_many :roles_users
has_secure_password
GENDERS = [ "Female", "Male" ]
#Roles = %w[admin, doctor, patient]
def role?(role)
return !!self.roles.find_by_name(role.to_s)
end