Unfortunately, this returns with:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.friends
I know it's to do with the <% @user.friends.each do |friend| %> line,
but i can't seem to overcome this, despite an evening of google
searches.
Can anyone help?
Hopefully.
You're referencing user.info.lastname, user.info.location,
user.info.pref and @user.friends. Note the @, that makes reference to
an instance variable which might not exist. you'd probalby wanted to
say user.friends there.
Well... that depends on what are you using those files, I would
strongly recommend using paperclip or attachment_fu.
If you're uploading/handling your files by hand, you should be the one
who knows where your files are stored and you'll be responsible for
building the image path.
Hello... +1 for paperclip or attachment_fu; they will make this a lot
easier for you.
Earlier this year I wrote a detailed tutorial on how to setup and use
Paperclip in a new Rails application. Coincidentally, my example was
to attach photos to users and then to show different size photos. At
the bottom, I explain how to display a thumbnail for each user in a
table, similar to what you're trying to do.