Thursday 15 July 2010

how to render list of children class in ruby on rails? -


Hi there ,

I use rail through one Starting a small project, all the main things are among some doctors, patients and counseling. I am learning with a book to start my application and still, it works well, but I still need help for a little turning! For example, once I became a doctor, I can make a consultation but my counsel requires a patient and I do not know how to present a list of patients in my consultation.

Is there any clue?

PS: This is my code

= & gt; Doctor

  needs to digest a class' Doctor & lt; ActiveRecord :: Base attr_accessible: Date of Birth ,: Birthplace: City, Country ,: firstname ,: id_card_no ,: lastname,: mail,: password: secu_no ,: street ,: street_number ,: zip attr_accessor: password verifies: date of birth, : Birthplace, City, Country ,: firstname ,: lastname ,: id_card_no,: secu_no ,: street ,: street_number ,: zip ;: appearance = & gt; Verifies true: id_card_no ,: secu_no ,: specification = & gt; True confirmation: street_number ,: zip, numeracy = & gt; Correctly valid: password, confirmation = & gt; True,: length = & gt; {: Inner = & gt; 4..20} ,: Appearance = & gt; True if, if & gt; :Password required? Valid: Mail ,: Specification = & gt; True,: length = & gt; {: Inner = & gt; 5..50},: format = & gt; {: With = & gt; /^[^@][\w-]+@[\w-]+[[[]]]]2/4}$/i} has_and_belongs_to_many: Offices have_and_belongs_to_many: attribute has_and_belongs_to_many: Secretaries have_many: Discussions The order of default_scope ('doctors. Unknown') first_sf: encrypt_nu_password df self.authenticate (email, password) user = search_b_mail (e-mail) user will be returned to user & amp; User.authenticated? (Password) end DEIF certified? (Password) self.hashed_password == encrypt (password) def defrite_new_password if password.blank? Self.hashed_password = encrypt (password) end password password_required? Hashed_password.blank? || Password.present? And Def Encrypt (String) Digest :: SHA 1 Hexdogest (string) end and   

= & gt; Patient class patient & lt; ActiveRecord :: Base attr_accessible: Date of birth, birthplace,: city, country,: firstname ,: id_card_no,: job,: lastname,: secu_no ,: street ,: street_number ,: zip verifies: birthdate, birthplace, city ,: Country ,: firstname ,: lastname ,: id_card_no ,: secu_no ,: street ,: street_number ,: zip ,: presence = & gt; Verifies true: id_card_no ,: secu_no ,: specification = & gt; Verifies true: street_number ,: ZIP,: numerity = & gt; True: Medium: Consultation default_scope order ('Patient. Unknown') End

= & gt; Consulting

  class counseling & lt; ActiveRecord :: Base attr_accessible: Date ,: Hours Verifies: Date, Hours ,: Attendance = & gt; True is_to: Patient belongs_to: doctor has_one: patient_description has_one: consultation_file has_and_belongs_to_many: diseases have_and_belongs_to_many: symptoms end   

thanks

I think you "archive_sick" on a "patient_ide" column of a consultation.

No comments:

Post a Comment