From: BlueHandTalking Date: 2010-01-13T04:40:06+09:00 Subject: Re: NOOB Question on Instance Variable Phrogz, thank you for answering my question: > > 1) Must an instance variable always be the same > > name as the name of the class? > > No. In regard to the below: > > @displayphoto = Photo.find_by_project_id(params[:id]) > > > The @displayphoto instance returns a nil object. I know that your response is incorrect in regard to > That would appear to be because find_by_project_id is returning nil, > given the code you've shown. ...because the same exact code works correctly with the name being @photo instead of @displayphoto. And for the below: > I believe that you are not testing what you think you are testing. > Where are you later asking for the value of @photo versus > @displayphoto. It is extremely unlikely that what you think is > happening is true. > That could be true, something is definitely wrong somewhere :) Jet