Unable to read values from object returned from ActiveRecord.find
- by Venki
I make the following call to the DB.
@patientRegistration = PatientRegistration.find(:all, :conditions=["name = '#{patientName}'"])
Search for patient registration based on a given name. I get a valid @patientRegistration object.When I invoke @patientRegistration.inspect it prints correctly all the values for the object in the DB.
But when I try to read a particular attribute (Say id or name) by doing the following: @patientRegistration.id or @patientRegistration.name. I get invalid values. Either its blank or some junk values. I dont understand how inspect is able to retrieve all the values correctly but reading individual attributes gives invalid values.
Thanks