1] I had a “Patient” model which is in a one to one relationship with
the “PersonName” model
class Patient < ActiveRecord::Base
has_one :person_name
end
class PersonName < ActiveRecord::Base
belongs_to :patient
end
2] “person_name” has the “last_name” and “first_name” as 2 of the fields
3] I am trying to find the Patient on the basis of his last_name , how
do i go about doing this , any example’s will be HIGHLY appreciated.
The way i entered the data in was first create a PersonName
@personName = PersonName.new ( :last_name => “jack” , :first_name =>
“daniels”)
@patient.person_name = @personName
Thanks in advance.