2011-10-18 4 views

答えて

2

ありませんが、あなたは、あなたが言った何をした後、各サブクラスのための固有の属性が含まれているモデルに関連付けを追加することができます。その後、delegateを使用すると、シームレスに見えるようにすることができます。

class User 
end 

class Doctor < User 
    has_one :doctor_profile 
    delegate :phd_in, :to => :doctor_profile 
end 

class Patient < User 
    has_one :patient_profile 
    delegate :symptoms, :to => :patient_profile 
end 

class DoctorProfile 
    # E.g. attributes: phd_in:string 
end 

class PatientProfile 
    # E.g. attributes: symptoms:text 
end 
+0

ありがとうございました!それは私の問題を解決しました。 – aperez

関連する問題